2014-11-04 43 views
1

我想在控制檯應用程序上運行我的SSDB包在MSDB上,但我不斷收到錯誤。試圖手動在MSDB上運行SSIS包,但得到錯誤

Application app = new Application(); 
Package package = app.LoadFromSqlServer("\\File\\Path\\" + paramName, ".", "MSDBUser", "password", null); 
DTSExecResult result = package.Execute(); 
Console.WriteLine("Package Execution Results: {0}", result.ToString()); 

我不斷收到錯誤:

"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.\r\n" 

我想它與我打電話包運行我是過時的方式做,但我真的不知道。任何人都可以幫助我,並提供一些更好的方法來做到這一點?任何幫助將非常感激。謝謝!

+0

看來您創建了4.0框架項目,並且您正在嘗試使用2.0。嘗試按照[此帖子]上的說明操作(https://social.msdn.microsoft.com/Forums/zh-CN/92381c34-7962-49dd-8127-9727dfa60d6f/error-calling-dtsx-package-from-c ?論壇= sqlintegrationservices)。 – 2014-11-05 00:24:26

+0

@AlessandroAlpi - 在我的app.config的啓動部分設置'useLegacyV2RuntimeActivationPolicy =「true」'做了訣竅。謝謝!如果你想寫答案,我會將其標記爲正確的。 – scapegoat17 2014-11-05 13:05:46

回答

2

看來您已經創建了4.0框架項目,現在您正在嘗試使用2.0框架。在this post中,您可以找到解決問題所需的所有設置。

相關問題