问题描述
我们有一个复杂的解决方案(22个子项目,其中一个是网站),无法使用TFS Build进行构建.如果我在构建服务器上打开解决方案,则代码可以在Visual Studio中正常编译,但是如果我打开CMD提示符并尝试 MSBUILD piccsserver.sln ,则会出现此错误:
We have a complex solution (22 sub-projects, one of which is a website) that won't build using TFS Build. If I open the solution on the build server the code compiles fine inside of Visual Studio, but if I open a CMD prompt and try MSBUILD piccsserver.sln I get this error:
"C:\TFS2017_agent\_work\4\s\CorePlatform\PICCS\Main\src\piccsserver.sln"
(default target) (1) ->
"C:\TFS2017_agent\_work\4\s\CorePlatform\PICCS\Main\src\PICCS_WebHost.metaproj"
(default target) (24) ->(Build target) -> ASPNETCOMPILER : error ASPCONFIG: Could not load file or assembly 'Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not mat
ch the assembly reference. (Exception from HRESULT: 0x80131040) [C:\TFS2017_age
nt\_work\4\s\CorePlatform\PICCS\Main\src\PICCS_WebHost.metaproj]
我注意到,当我从VS内部构建并查看网站bin文件夹中的NewtonSoft.Json.dll版本时,该版本是我期望的11.0.1,但是当我从命令提示符构建时版本是4.5.11.15520.
I notice that when I build from within VS and look at the version of NewtonSoft.Json.dll in the website's bin folder, the version is 11.0.1 which is what I expect, but when I build from the command prompt the version is 4.5.11.15520.
这到底是怎么回事?不从VS内部构建使用MSBUILD吗?
What the heck is going on here? Doesn't building from within VS use MSBUILD?
推荐答案
我可以使用它.我将Web.config中的newVersion的值从11.0.0.0更改为11.0.1.0.不知道为什么如果仅从命令行进行构建,为什么会停止,但是现在它既可以在VS中构建,也可以在命令提示符下构建.
I got it to work. I changed the value of newVersion in the Web.config from 11.0.0.0 to 11.0.1.0. No idea why that stops if from building only from the command-line, but now it builds both in VS and at the command-prompt.
从此:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0." newVersion="11.0.0.0" />
</dependentAssembly>
对此:
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0." newVersion="11.0.1.0" />
</dependentAssembly>
这篇关于为什么在VS内构建正常时,msbuild会失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!