I've freshly checked out a .NET 4.5.2 MVC project from github. I can build and run it locally. However, publishing fails when a bunch of XML can't be found in the bin
folder which Visual Studio tries to copy to obj\Release\Package\PackageTmp\bin
. The error message includes Could not find file bin\Microsoft.Owin.Security.Cookies.xml
. These files are marked with a yellow warning sign in the solution explorer, and manually doing right click->exclude from project solves the issue. However, on the next git sync, they are included again. They all have the name of a library, e.g. there will be Newtonsoft.Json.dll
in the bin
folder and Visual Studio is missing Newtonsoft.Json.xml
.
Are they usually automatically created? Should they somehow be excluded from deployment?

- 1,772
- 3
- 18
- 48
1 Answers
Newtonsoft.Json.dll
belongs to Newtonsoft nuget package these. The triangle shows that required nuget package was not installed.
Now when you rebuild a project these packages should get installed by itself. If you are using an older version of VS then you would need to Right click on solution ->select Restore Nuget Pakage manually.
The build works as the git submitted code must have the installed systems build package also synced. But on publishing it tries to rebuild and finds the nuget packages missing in your local repo.
So instead of excluding google and add referenced nuget packages.
Like from OP you need to install Newtonsoft
and Microsoft.Owin.Security.Cookies
. packages. After their addition if yellow triangle reference to older version still shows up then you can delete them.

- 3,657
- 3
- 20
- 45
-
`Newtonsoft.Json.dll` was present, as were all needed binaries. All those marked missing were XML files of the same name as certain libraries, e.g. `Newtonsoft.Json.xml`. – smcs Apr 05 '16 at 00:17
-
More details of these XML file can be found from this (answer)[http://stackoverflow.com/a/32191937/2898399], as you can see you don't specifically need these files to be present when you deploy. Why not add these files to your git ignore list? That would solve the problem on your next sync. – Jerin Apr 05 '16 at 04:03
-
@Jerin I don't get why adding them to the git ignore list would solve the problem of publishing operation not finding them. Does MSBuild actually look into git ignore files? – Medinoc Apr 14 '23 at 13:50