Alex Edelstein
Alex Edelstein

Reputation: 528

When adding new project in Visual Studio, existing references can't be added to it

Symptoms were: Existing Solution with working projects referencing each other. Added a new project Tried to AddReference some of the existing projects.

Result: the little yellow warnings in the References part of the project in Solution Explorer

The error message just says that the reference can't be found, and the Path property for the problematic references cannot be manually pasted in or edited.

Question is: how do I properly add those references? They're clearly working for the existing projects.

Upvotes: 1

Views: 214

Answers (1)

Alex Edelstein
Alex Edelstein

Reputation: 528

The simple answer is that the new project defaulted to one version of .Net (4.5), and one of the other projects in the solution was targeting 4.5.1. This created a cascade of failures.

Once you find the right alert, the problem is crystal clear:

16>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3274: The primary reference "C:\code\liki\Source\Shared\LoggingManager\bin\Debug\LoggingManager.dll" could not be resolved because it was built against the ".NETFramework,Version=v4.5.1" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.5".

What made this a challenge was that this alert doesn't get shown as a build error. It's one of hundreds of pieces of build output that I don't usually look at, and VS's method of switching the view away from the Build Output to the Error List can exacerbate the situation.

Upvotes: 1

Related Questions