I have a .NET console application that loads and executes an SSIS package. The console app is written in C#, targets .NET Framework 4, and has been working successfully for a long time (including various migrations from SQL 2005 to SQL 2008 R2). We just upgraded to SQL 2012, and now the console app throws an error when trying to run the package.
Here is the error that SSIS is logging:
Message: The Execute method on the task returned error code 0x80131621 (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.). The Execute method must succeed, and indicate the result using an "out" parameter.
I can step through my console app's code and see that it does indeed successfully load the package; and then it even successfully updates a user variable and a couple of connectionstrings in the package's Connection Managers. It throws the error when the Execute method is called.
After some online searching, I added the following to my app.config file, and the whole thing successfully worked.
<startup useLegacyV2RuntimeActivationPolicy="true" >
However, I find this disconcerting, as I feel like it's taking a step backwards. My console app was already targeting .NET 4. It was the SQL upgrade that seems to have caused this issue. Are we really saying that the latest version of SSIS (my app references the ManagedDTS assembly), was compiled against and older version of the framework, .NET 2.0?
The package itself does not have any script tasks or components, just a bunch of derived columns, execute SQL tasks, and some conditional splits. The source file / connection manager is a Flat File; the destination is our SQL (now 2012) server. I've even opened up the package in the new SQL Data Tools application and resaved it, thinking it needed to be "upgraded." No change.
(That's another issue I have. Why does SQL 2012 install a Visual Studio 2010 "shell"? Wasn't this Microsoft's chance to finally get these tools all synched up? I have VS 2012 installed, then I install SQL 2012, and I get VS 2010... and the resulting mixed bag of dll versions!)
Anyway, unless I have that "useLegacyV2RuntimeActivationPolicy" attribute in the app.config, it fails on the Execute method.
Any details on this would be appreciated.