在F#Interactive中运行混合模式程序集错误

时间:2015-04-15 05:08:38

标签: powershell deployment ssis f# f#-interactive

我尝试将以下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(Boolean execSsisStartup)    at。$ 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()

1 个答案:

答案 0 :(得分:1)

基于this question,您应该可以通过在<configuration> <{1}}的{​​{1}}节点内添加以下内容来解决此问题

%programfiles(x86)%\Microsoft SDKs\F#\3.0\Framework\v4.0\fsi.exe.config