【发布时间】:2017-02-01 10:15:22
【问题描述】:
安装 Visual Studio 2017 RC 后,我有一些无法构建的代码。我已将其范围缩小到 WMP 和 .NET Framework 2(它在 Framework 4 下工作)
最基本的测试设置是 2 个项目:
项目一:
- Windows 窗体应用程序
- .NET 框架 2.0
- 命名空间 WMPClient
- 添加到 wmp.dll 的引用(已尝试 system32 和 syswow64)
- 向 Form1.cs 添加了 Windows Media Player
项目 2:
- 类库 (.NET Framework)
- .NET Framework 2.0
- 命名空间 WMPLib
- 已添加到 WMPClient 的参考
两个项目都构建。
将using WMPClient; 添加到Class1.cs(项目2)时,构建失败:
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 CS0246: The type or namespace name 'WMPClient' could not be found (are you missing a using directive or an assembly reference?)
同样的代码在 VS2013 下也不再工作了,但是在安装 VS2017 之前就可以了
【问题讨论】:
-
有没有办法为 System.Windows.Form 版本 2.0.0.0 设置特定目标?
-
每个系统参考的属性显示“运行时版本 = v2.0.50727” - 这适用于两个项目
标签: c# .net-2.0 visual-studio-2017