为什么 Msbuild 不复制 Microsoft.AspNet.WebApi.Client 引用的 Newtonsoft.Json.dll?
Why Msbuild does not copy Newtonsoft.Json.dll referenced by Microsoft.AspNet.WebApi.Client?
我的 Web 项目 A 引用了我的项目 B,后者引用了 Microsoft.AspNet.WebApi.Client
,后者引用了 Newtonsoft.Json
程序集。它没有在其他任何地方被引用。问题是在我的部署服务器上 Newtonsoft.Json
没有被复制到 bin
目录一次 运行 作为
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe .\src\path.to.Web.projectA.csproj /t:Rebuild /p:Configuration=Release
它最终因这个异常而崩溃:
FileNotFoundException: Could not load file or assembly
'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral,
PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The
system cannot find the file specified.
我已经通过向项目 B 添加存根代码解决了这个问题:
string json = JsonConvert.SerializeObject(new Something());
有人能说说为什么以前没有复制吗?
注意。这些问题似乎没有回答问题或过时或我错过了什么?
- MSBuild does not copy directly referenced dlls to bin folder
- msbuild not copying referenced assembly
- MSBuild doesn't copy references (DLL files) if using project dependencies in solution
- http://blog.alexyakunin.com/2009/09/making-msbuild-visual-studio-to.html
- Copying a DLL's dependencies in Visual Studio
我在Alex的博客下发表了评论post,
It does not work for me when the indirect dependency comes from NuGet packages (Microsoft.AspNet.WebApi.Client and Newtonsoft.Json). But the tip described in http://www.paraesthesia.com/archive/2014/05/09/recursively-copying-indirect-project-dependencies-in-msbuild.aspx/ solves the issue. I think it uses a more suitable indirect dependency detection approach.
如果您遵循该解决方案,则根本不需要使用存根。
关于为什么没有复制 dll,它已经缩小到 MSBuild 问题(或更多,因为相关报告太多),Microsoft 声称不会在 Connect 上修复,
我的 Web 项目 A 引用了我的项目 B,后者引用了 Microsoft.AspNet.WebApi.Client
,后者引用了 Newtonsoft.Json
程序集。它没有在其他任何地方被引用。问题是在我的部署服务器上 Newtonsoft.Json
没有被复制到 bin
目录一次 运行 作为
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe .\src\path.to.Web.projectA.csproj /t:Rebuild /p:Configuration=Release
它最终因这个异常而崩溃:
FileNotFoundException: Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.
我已经通过向项目 B 添加存根代码解决了这个问题:
string json = JsonConvert.SerializeObject(new Something());
有人能说说为什么以前没有复制吗?
注意。这些问题似乎没有回答问题或过时或我错过了什么?
- MSBuild does not copy directly referenced dlls to bin folder
- msbuild not copying referenced assembly
- MSBuild doesn't copy references (DLL files) if using project dependencies in solution
- http://blog.alexyakunin.com/2009/09/making-msbuild-visual-studio-to.html
- Copying a DLL's dependencies in Visual Studio
我在Alex的博客下发表了评论post,
It does not work for me when the indirect dependency comes from NuGet packages (Microsoft.AspNet.WebApi.Client and Newtonsoft.Json). But the tip described in http://www.paraesthesia.com/archive/2014/05/09/recursively-copying-indirect-project-dependencies-in-msbuild.aspx/ solves the issue. I think it uses a more suitable indirect dependency detection approach.
如果您遵循该解决方案,则根本不需要使用存根。
关于为什么没有复制 dll,它已经缩小到 MSBuild 问题(或更多,因为相关报告太多),Microsoft 声称不会在 Connect 上修复,