我有几个项目的解决方案,其中许多项目都引用了 Apache 的 log4net。我目前正在尝试构建其中一个项目(一个类库)来解决我遇到的引用问题,但还没有成功。
只有在 Windows 8 上的 VS2012 中构建时才会出现警告和错误,而在 Windows 7 上的 VS2010 中不会出现。
有人知道我该如何解决这个问题吗?这是警告消息;
The primary reference "log4net" could not be resolved because it was built against the ".NETFramework,Version=v4.0.1,Profile=Client" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client".
错误信息如下:
The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Rune\Documents\Team Foundation Server\noOdin\Yggdrasil\OdinLib\Common.cs
The type or namespace name 'ILog' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Rune\Documents\Team Foundation Server\noOdin\Yggdrasil\OdinLib\Common.cs
我现在忽略这些错误,因为它们是未加载 log4net 引用的结果。
引用包含在我的 .csproj 文件中,如下所示:
<Reference Include="log4net"><HintPath>..\..\Dependencies\log4net.dll</HintPath></Reference>
因此,问题确实是我收到的警告,因为它似乎在我的 Dependencies 文件夹中找到了我的 log4net.dll 文件。
有人知道我该如何解决吗?
请务必询问您是否需要更多信息。
最佳答案
<SpecificVersion>False</SpecificVersion>
在强制使用特定版本的 log4net
的 csproj 文件中丢失-图书馆。
将此答案添加到未回答列表中的问题 :)
关于c# - Windows 8 上 VS2012 中的依赖引用问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13544600/