David Pfeffer
David Pfeffer

Reputation: 39872

Reference alternate to reference assembly in Visual Studio 2010?

I'm trying to use an alternative core framework library while still targeting .NET Framework 4.0. When I add a manual reference to the alternate file, Visual Studio instead creates a reference to the same named file in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\.

Can I disable this behavior?

Upvotes: 1

Views: 422

Answers (2)

seldary
seldary

Reputation: 6256

If the dll is already in the GAC, removing existing dlls will not work.
Try to mark the reference as Specific Version = true (Right click -> Properties).

EDIT:
After you have added the reference (even if the wrong one was actually added), edit your csproj file, find the reference, and edit it with your specific dll properties:

<Reference Include="Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <SpecificVersion>True</SpecificVersion>  
  <HintPath>..\..\ExternalLibrary\Microsoft.Practices.EnterpriseLibrary.Logging.dll</HintPath>
</Reference>

Upvotes: 3

Leniel Maccaferri
Leniel Maccaferri

Reputation: 102448

Try this:

1 - Remove the reference.

2 - Clear your project bin/debug folder. If possible delete these
folders!

3 - Add the reference again.

You may need to restart Visual Studio between the steps described above.

Upvotes: 0

Related Questions