My web projectA references my projectB that references Microsoft.AspNet.WebApi.Client
that references Newtonsoft.Json
assembly. It is not referenced anywhere else. The problem was that on my deployment server Newtonsoft.Json
was not copied to bin
directory once run as
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe .\src\path.to.Web.projectA.csproj /t:Rebuild /p:Configuration=Release
And it eventually broke with this exception:
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.
I've resolved it by adding a stub code to projectB:
string json = JsonConvert.SerializeObject(new Something());
Can someone describe why it was not copied before?
Note. These questions do not seem to answer the question or out of date or I miss 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