[英]Indirect dependency - .NET2.0 - WMP.dll
After installing Visual Studio 2017 RC, I have some code that cannot build. 安装Visual Studio 2017 RC后,我有一些无法构建的代码。 I have narrowed it down to WMP and .NET Framework 2 (it works under Framework 4)
我已将其缩小到WMP和.NET Framework 2(它在框架4下工作)
The most basic test setup is 2 projects: 最基本的测试设置是2个项目:
Project 1: 项目1:
Project 2: 项目2:
Both projects build. 这两个项目都在建
When adding using WMPClient;
using WMPClient;
添加using WMPClient;
to Class1.cs
(project 2) the build fails: 到
Class1.cs
(项目2),构建失败:
13 error lines like System.Windows.Forms, mscorlib, System
13个错误行,如
System.Windows.Forms, mscorlib, System
warning MSB3258: The primary reference "C:\\WMPClient\\bin\\Debug\\WMPClient.exe" could not be resolved because it has an indirect dependency on the .NET Framework assembly "System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0" than the version "2.0.0.0" in the current target framework.
1 error line like this: 像这样的1个错误行:
error CS0246: The type or namespace name 'WMPClient' could not be found (are you missing a using directive or an assembly reference?)
The same code does not work under VS2013 anymore either, but did before installing VS2017 相同的代码在VS2013下也不起作用,但在安装VS2017之前做了
it says your "WMPClient.exe" has a higher version 4.0 of .net framework. 它说你的“WMPClient.exe”有更高版本的4.0 .net框架。 And by principle one cannot add higher version libraries or namespaces in a lower .NET version project.
原则上,不能在较低的.NET版本项目中添加更高版本的库或命名空间。 So, Either build "WMPClient.exe" with 2.0, or upgrade your Forms Project to 4.0
因此,使用2.0构建“WMPClient.exe”,或将Forms Project升级到4.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.