I have tried to convert the following powershell script for deploying a 2012 SSIS Project to an F# script.
I seem to be getting the following error when I try and run this through F# Interactive when evaluating the catalog.Create() line:
System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. at Microsoft.SqlServer.Management.IntegrationServices.Catalog.CheckDatabase(IntegrationServices store) at Microsoft.SqlServer.Management.IntegrationServices.Catalog.Create(Boolean execSsisStartup) at .$FSI_0007.main@() Stopped due to error
I am running this using Microsoft Visual Studio Express 2012 for Web. Could it be that F# interactive is running under 4.0 instead of the 2.0 runtime? Can this be changed somehow?
The start of the script I converted can be seen below:
// 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()