我有几个项目的解决方案,其中许多项目都引用了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:UsersRuneDocumentsTeam Foundation ServernoOdinYggdrasilOdinLibCommon.cs
The type or namespace name 'ILog' could not be found (are you missing a using directive or an assembly reference?) C:UsersRuneDocumentsTeam Foundation ServernoOdinYggdrasilOdinLibCommon.cs
我现在忽略了这些错误,因为它们是 log4net 引用未加载的结果。
该引用包含在我的 .csproj 文件中,如下所示:
<Reference Include="log4net"><HintPath>....Dependencieslog4net.dll</HintPath></Reference>
因此,问题实际上是我得到的警告,因为它似乎在我的依赖项文件夹中找到了我的 log4net.dll 文件。
有人知道我该如何解决这个问题吗?
如果您需要更多信息,请询问。
csproj文件中缺少<SpecificVersion>False</SpecificVersion>
,这强制使用特定版本的log4net
库。
将此答案添加到未回答列表中的问题中:)