1

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?

David Pfeffer
  • 37,721
  • 29
  • 123
  • 200

2 Answers2

3

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>
seldary
  • 6,096
  • 4
  • 39
  • 55
0

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.

Leniel Maccaferri
  • 97,176
  • 43
  • 357
  • 461