1

I added a new packages that required Newtonsoft.Json version >= 9.0.1 while so far I had 8.0.2.

The solution builds and runs fine on VS. However, when I push the branch, the continuous deployment build on Azure fails.

The type or namespace name 'Newtonsoft' could not be found

There isn't any error on assembly loading or resolving.

However if I publish on Azure from Visual Studio it works.

What can be wrong with my CD build and how can I repare it?

The solution has only one project.

François
  • 3,164
  • 25
  • 58

2 Answers2

0

Make sure that you have same Newtonsoft.Json version across all your projects.

Check that Newtonsoft.Json assemblyBinding in config files is right and same across all projects

Make sure that you Enabled NuGet Package Restore

Vova Bilyachat
  • 18,765
  • 4
  • 55
  • 80
  • @François did you enable nuget packages restore? – Vova Bilyachat Feb 19 '17 at 23:28
  • Yes. CD works fine for weeks. It's that package update that broke it somehow. – François Feb 19 '17 at 23:29
  • @François i would try to remove all packages locaaly and try to build one more time. Also check assemblyBinding in web.config if its using right version – Vova Bilyachat Feb 19 '17 at 23:30
  • The build is on the server. If my github repo as no change nothing different will happen on the server. What's the point of doing anything locally that won't generate any commit? – François Feb 19 '17 at 23:33
  • You said that publish from VS works it could be because of some old packages. – Vova Bilyachat Feb 19 '17 at 23:35
  • Maybe VS publishes an old package somehow. But I already forced uninstall and install and checked assemblyBindings (I read multiple SOF related questions). – François Feb 19 '17 at 23:44
  • @François this is why i would try to remove packages and try to do it again. Other idea try to check csproj file and see to which folder reference goes – Vova Bilyachat Feb 19 '17 at 23:45
0

All the SOF questions about uninstalling\reinstalling Newtonsoft package as well as checking assemblyBindings etc led me in a wrong direction.

My build server (Azure Continuous Deployment) loads packages in a folder called packages at the root of the solution. However as I have many solutions on my machine, I have a single package folder elsewhere. In order for the build server to work, I had created a junction package folder at the root of my solution linked to the proper package folder of my machine. What I had forgotten is that when I add new packages, Visual Studio put the paths of the correct package folder rather than the junction.

Hence, in order to repair my server build I just had to edit my csproj file to redirect new (and updated like Newtonsoft) packages to the junction folder.

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
François
  • 3,164
  • 25
  • 58