2013-10-03 68 views
3

我有大約100個SSIS包負責將數據從一個產品遷移到另一個產品。這些軟件包幾乎總是包含至少一個腳本任務和/或腳本組件,這些腳本任務和/或腳本組件使用.NET 3.5中構建的自定義DLL並且具有強命名。每次我在包中引用它時,我們都要確保引用的屬性「特定版本」設置爲false。在部署SSIS包的環境中,使用gacutil.exe對DLL進行了GAC處理,並將其轉儲到SQL Server程序集緩存中。SSIS 2008:在腳本任務/腳本中使用自定義DLL的版本

我遇到的問題是我的自定義DLL的版本隨着TFS的每個構建而增加。從我所做的研究看來,引用「特定版本」屬性似乎沒有效果。由於我們使用DLL的1.0.0.0開發,它仍然在尋找該版本。我能夠解決這個問題的唯一方法就是打開SSIS包中需要它的每個腳本任務並簡單地保存。這不是一個可行的選擇。我還發現一個博客帖子(http://dougbert.com/blog/post/Recompile-VSTA-scripts-programmatically-in-SSIS.aspx),它可以讓我們自動執行該操作,但與100多個SSIS包來執行這個它會花費太多時間保存/更新我所有的SSIS包

注:我也在使用C#API執行SSIS包。

我在尋找:

  • 任何解決方案,使我們能夠繼續使用的內部版本的DLL中的SSIS腳本任務/腳本組件
  • 如果這個問題得到解決,而不SSIS 2012

下面是錯誤,我得到:

Error in Microsoft.SqlServer.Dts.Runtime.TaskHost/ : 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'CustomDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=119c04fbde27c5df' or one of its dependencies. The system cannot find the file specified. 
File name: 'CustomDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=119c04fbde27c5df' 
    at ST_240ac16d255540ce822401f59c67e591.csproj.ScriptMain.Method1() 
    at ST_240ac16d255540ce822401f59c67e591.csproj.ScriptMain.Main() 

WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated with assembly bind failure logging. 
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 

    --- End of inner exception stack trace --- 
    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 
    at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) 
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) 
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) 
    at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) 
    at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) 
    at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()</c 
+1

看起來你需要一個綁定策略。查看[此鏈接](http://social.microsoft.com/Forums/zh-CN/0891f0cb-1f9a-44c3-a93f-f81eefece6e8/specific-version-copy-local-settings-are-ignored?forum=netfxbcl )。 –

回答

1

特定版本不用於此目的。您需要在配置文件中設置一個綁定策略,該配置文件將允許在運行時接受一個程序集版本號來代替另一個程序集版本號。看看this link - 它解釋得比我所能做的更好。

+0

這就是我不得不做的,你鏈接的帖子最終幫助我在MSDN上找到了這些。 http://msdn.microsoft.com/en-us/library/twy1dw1e.aspx http://msdn.microsoft.com/en-us/library/eftw1fys.aspx http://msdn.microsoft.com /en-us/library/7wd6ex19.aspx 我能夠在機器配置中解決這個問題,或者我將綁定重定向放在配置中,用於任何稱爲DTS API的配置。 –