2012-01-26 54 views
1

我正在尝试使用另一个核心框架库,同时仍以.NET Framework 4.0为目标。当我添加对备用文件的手动引用时,Visual Studio会在C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\中创建对同一个命名文件的引用。Visual Studio 2010中引用程序集的引用备用?

我可以禁用此行为吗?

回答

3

如果dll已经在GAC中,则删除现有的dll将不起作用。
尝试将参考标记为Specific Version = true(右键单击 - >属性)。

编辑:
在您添加引用(即使实际上加入了错误的),编辑您的csproj文件,找到参考,并与您的特定DLL的属性编辑:

<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> 
+0

我无法首先添加引用,因此无法标记“特定版本= true”。 –

+0

查看编辑答案 - 希望它有帮助... – seldary

+0

这样做,再加上找到替换大会的新强名称,完美工作。谢谢! –

0

试试这个:

1 - Remove the reference. 

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

3 - Add the reference again. 

您可能需要重新启动上述步骤之间的Visual Studio。

+0

无运气。任何其他想法? –

+0

尝试在Visual Studio中运行Clean解决方案命令...您确定可以在.NET 4.0中使用这个替代DLL吗?它支持.NET 4吗?看看这个:http://stackoverflow.com/questions/5575253/old-dll-keeps-being-used –

+0

也试过干净。该DLL绝对支持.NET 4.0。 –

相关问题