2015-05-01 83 views
0

我正在嘗試將一些構建腳本與.NET項目放在一起,並將一些CLR代碼部署到SQL Server。如果我通過選擇「Build」在Visual Studio中構建DLL,我已經簽署了程序集並可以將其部署爲存儲過程。在EXTERNAL ACCESS的登錄下部署後運行存儲過程可以正常工作。CLR DLL在VS中部署良好,但不通過MSBuild

但是,如果我編譯DLL有一個MSBuild腳本,我得到部署(同樣的過程)後,在SQL Server下面的錯誤,並試圖運行存儲過程:

Msg 10314, Level 16, State 11, Line 5 
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65562. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: 
System.IO.FileLoadException: Could not load file or assembly 'assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ea3705e3b2b05e85' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) 
System.IO.FileLoadException: at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) 

我的MSBuild文件只是調用在我的解決方案建立在項目文件:

<MSBuild Projects="Project1/Project1.csproj" Targets="Build" /> 

我懷疑這可能是一個目標框架問題(我需要這是.NET 2.0,並配置爲該),但使用/p:TargetFrameworkVersion=v2.0仍沒工作。

這兩個彙編爲什麼不同?

編輯:我試圖編譯所有CPU

回答

相關問題