2015-05-01 78 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

回答

相关问题