Building a large solution with multiple dependencies fails unless built manually

287 views Asked by At

I have a faily large solution with 56 projects. Sometimes, when cloning the repo to a new work area and rebuilding from scratch, I get weird problems.

It goes like this:

I load the checked out solution file, and get about 20 stacked dialog-boxes that want me to restore NuGet-libraries. Fine, I do that (but laugh a little about the stacked dialogs)

I do Build-Clean Solution

I do Build-Build Solution

I get 63 Errors of type CS0006 Metadata "MySolution\MyProject\bin\Debug\MyProj.dll" could not be found. About 4-5 DLLs are referenced in these errors.

I then build these "by hand" by right-clicking and doing rebuild, and ultimately I can build the whole project. Obviously, there are some dependency problems, but how can I investigate it since it is supposed to work "automagically"? I would almost prefer to create the build file myself....

Any ideas?

2

There are 2 answers

0
Peter Andersson On BEST ANSWER

Turns out the project (not mine!) was missing Build Dependencies between projects. Apparently I don't fully understand the dependency management (have switched from Java to C# this year), I thought it was more automatic, since I could do "using"-statements without problem I though dependency was setup, but in some cases they were missing. I will investigate this further later on, but for now its is enough that I know that I will have to check each error by itself and verify with the Build settings.

2
Shujaat Ali On

Go to the physical location of project folder -> right click go to properties -> remove or un-check read-only (remove folder read-only) and rebuild solution.

The problem is, sometimes due to, your local copy of solution is read-only and you are trying to build solution (it will try to delete/replace some .exe file during build, but it has restrictions due to read-only mode.)

Nuget package will only restore when physical local package folder not exist or deleted. You can manually delete package folder and build solution, it will first load or install all the dependencies.

try this, may be it will work.