Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Broken references in solution

I have a large solution with many project. We have about six developers working on this solution using VS2013 and it is source controlled by TFS 2013.

Periodically project references and file references to DLLs are broken. The little yellow sign with the black exclamation point shows next to the reference in the project references and when I look at the properties of the broken references, I noticed that the path was empty for the elements that are broken. I could remove and re-add the references, but I have done this a few times before and it keeps breaking again.

I Googled around and found several people talking about similar issues, but in most cases I see, after removing and adding the references, everything is ok. I my case, this keeps happening over and over.

Is there a known cause for this? I can keep re-fixing this, but it's just a workaround and not a solution.

like image 620
Elad Lachmi Avatar asked Jan 27 '16 08:01

Elad Lachmi


People also ask

What is the correct process to resolve references?

References are resolved using the following steps: If a reference has a HintPath metadata and a file exists at that path (absolute or relative to the project), it will be used. If the name of the reference itself refers to a valid file (absolute or relative to the project), it will be used.


2 Answers

Assuming ProjectFirst generates the DLLs for ProjectSecond, to narrow down the issue, you can first build the ProjectFirst and then build the ProjectSecond to see whether the behavior correct. If that works, you probably need to check your build order.

In Solution Explorer, select a project or select the solution. On the Project menu, choose Project Build Order to check the build order. On the Dependencies tab, select ProjectSecond from the Project drop-down menu. In the Depends on field, select the check box of ProjectFirst that must build before this project does.

Additionally, check ProjectSecond to see whether it by default to targeting .NET Client Profile. If it is, change it to regular .NET.

like image 74
Cece Dong - MSFT Avatar answered Oct 19 '22 08:10

Cece Dong - MSFT


We have a solution with hundreds of projects (> 400) and tens of thousands of source files and for some unknown reason a set of updates got applied to the machine right in the middle of a build, killing the build and closing Visual Studio. When VS was reopened some projects did not load (even after close and re-open) so had to sort through > 400 projects and find those that did not load and manually tell VS to reload the missing/not loaded projects. After that things seem back to normal.

like image 2
Mark Schultheiss Avatar answered Oct 19 '22 10:10

Mark Schultheiss