Nils
Nils

Reputation: 9941

Is it possible to make Visual Studio use *only* the HintPath for a given Reference

let's say have multiple older projects, each of which includes a reference to a given dll, like so:

<Reference Include="nunit.framework">
  <HintPath>..\lib\nunit.framework.dll</HintPath>
</Reference>

Now, I have updated to use nuget and some projects use a new refenrece like so:

<Reference Include="nunit.framework">
  <HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
</Reference>

the older dll in ..\lib\ was removed and I expected Visual Studio to fail the build for all projects that I forgot to update. Sadly VS does not... Rather it builds against some obscure dll-version it found somewhere on my machine..

Can I make VS (or msbuild for that matter) fail the build, if a given Reference does not exist on the HintPath?

Upvotes: 0

Views: 829

Answers (1)

Matt Whitfield
Matt Whitfield

Reputation: 6574

Simple answer to the title - no. It's a hint path, and VS will always search multiple locations for references. However, you could certainly cause the build to fail if a file doesn't exist - for example as answered in this question (although the condition would need to be not exists rather than exists).

It is actually a massive pain - as a developer of Visual Studio extensions I find the behaviour surrounding HintPath resolution causes me regular issues.

Upvotes: 1

Related Questions