【发布时间】:2015-06-20 22:16:02
【问题描述】:
我已尝试将以下 powershell script 用于将 2012 SSIS 项目部署为 F# 脚本。
当我在评估 catalog.Create() 行时尝试通过 F# Interactive 运行此程序时,我似乎遇到了以下错误:
System.IO.FileLoadException:混合模式程序集是针对运行时版本“v2.0.50727”构建的,如果没有额外的配置信息,则无法在 4.0 运行时中加载。 在 Microsoft.SqlServer.Management.IntegrationServices.Catalog.CheckDatabase(IntegrationServices 存储) 在 Microsoft.SqlServer.Management.IntegrationServices.Catalog.Create(布尔 execSsisStartup) 在 .$FSI_0007.main@() 由于错误而停止
我正在使用 Microsoft Visual Studio Express 2012 for Web 运行它。会不会是 F# interactive 在 4.0 而不是 2.0 运行时运行?这可以以某种方式改变吗?
我转换的脚本的开头如下所示:
// Variables
module Global =
let projectFilePath = @"C:\Projects2012\Internal Reporting\SourceControl\RKN BI DataWarehouse Solution\Releases\Release 1.1.1\SSIS\SSIS Dynamics CRM Staging Load.ispac"
let projectName = "SSIS Dynamics CRM Staging Load"
let folderName = "RKNBI"
let environmentName = "Dev"
// Load the IntegrationServices Assembly
#r "Microsoft.SqlServer.Management.Sdk.Sfc"
#r "Microsoft.SqlServer.Management.IntegrationServices"
#r "Microsoft.SqlServer.Smo"
#r "Microsoft.SqlServer.ConnectionInfo"
open System.Data
open Microsoft.SqlServer.Management.Sdk.Sfc
open Microsoft.SqlServer.Management.IntegrationServices
open System.IO
printfn "Connecting to server ..."
// Create a connection to the server
let sqlConnectionString = "Data Source=localhost;Initial Catalog=master;Integrated Security=SSPI;"
let sqlConnection = new SqlClient.SqlConnection(sqlConnectionString)
// Create the Integration Services object
let integrationServices = IntegrationServices(sqlConnection)
printfn "Removing previous catalog ..."
// Drop the existing catalog if it exists
if (integrationServices.Catalogs.Count > 0) then
integrationServices.Catalogs.["SSISDB"].Drop()
else
()
printfn "Creating new SSISDB Catalog ..."
// Provision a new SSIS Catalog
let catalog = Catalog(integrationServices, "SSISDB", "SUPER#secret1")
catalog.Create()
【问题讨论】:
-
在您的 .config 文件中查看程序集重定向,或者构建您所依赖的任何库,这些库是针对 2.0 从源代码构建的。
-
尝试使用融合日志来确定正在加载的 FSharp.Core 版本,这将可靠地回答您的问题。版本控制 W.X.Y.Z 的意思是,F# 版本 X.Y.Z 运行在 .net 版本 W 上。所以如果你看到类似 4.x.y.z 的东西,它运行在 .net 4 上。
标签: powershell deployment ssis f# f#-interactive