Yesterday I got a message from a collegue of mine that building a solution with Visual Studio failed ungracefully. He directly got the sources from git freshly, there was no interaction by him. I checked my last commits and couldn’t see anything that was wrong. So I just got all the sources in a new place and rebuild them.
I’ve got a pretty strange message on build, I’ve actually never seen before.
I did not use .net standard by now. As the framework chosen is 4.6.1, there is not possibility to combine .net standard 2.0 with .net framework. While I played around with .net standard it is actually not in use in this project.
Okay, reflexively did a clean and rebuild solution, but it didn’t help. The project that fails is a .net framework one, no interaction with .net core actually. Having a look onto the references looks like this:
The project references do work but all nu get packages seems to be corrupt. This this looks like a good task for Package Console Manager, let’s try it out. You can find it under tools\nuget package manager\Package Manager Console. In contrast to the user interface menu “Restore packages” it does add a lot more information directly to console.
Command update-package -reinstall started to remove and reinstall all the packages. Strange to say, Visual Studio decides to give up totally, crash and restarts itself.
Okay, that was not the first time that happens :-).
I just did the same steps again and magically it worked. Surprisingly, a reference to Microsoft Service Bus Messaging just vanished from another project in that solution. After adding it again it happily compiles.
Actually the same is reachable by just doing restore nuget packages on user interface on right mouse click on solution. After having done it once, the issue doesn’t come up anymore. It is still unclear why the problem comes up anyway. Starting the build pushes a lot of messages for restoring packages, but for some reason the restore on build does it differently and fails.
Package Console Manager tells some more details, as promised:
Even if there is no reference to .net standard at all in the project, nuget seems to remember my (unsuccessful) tries to combine .net standard 2.x with .net framework 4.6.x somehow? There is no package.config refering to .net standard or aspnetcore 2.x, there is no indication of any .net standard libs in whole project, there is actually no change in project files. Quite some kind of magic. Anyway, looks like an environment issue. Will add more information when I digged it up.
We have already the same issue.
After I reboot the Build-Server, it works fine.
But the issue comes up some weeks randomly.
Try delete all “obj” and “bin” folders from the projects of your solution. It worked for me when strange things like that started to happen…
Thanks for the hint! I did extract sources directly from git and did a rebuilt straight on. To that time there was no bin/ obj folders available.
Comments are closed.