[英]C#. Windows Form. Partial class problem when migration from .NET 4.6.1 to 4.6.2
I try to modify Target framework from .NET 4.6.1 to 4.6.2 in Project Properties window of VS2019.我尝试在 VS2019 的项目属性 window 中将目标框架从.NET 4.6.1修改为4.6.2 。
Compilation of version 4.6.1 is OK. 4.6.1版本的编译就OK了。
Compilation of version 4.6.2 fails: error CS0101: The namespace 'CoreClient' already contains a definition for 'ClientCore'.版本 4.6.2 的编译失败:错误 CS0101:命名空间“CoreClient”已包含“ClientCore”的定义。
I have 7 files with我有 7 个文件
public partial class ClienCore {}
All of the classes into the same namespace CoreClient.所有的类都放到同一个命名空间CoreClient。 The error message points only to one of file from them.错误消息仅指向其中一个文件。
For test, when I rename/delete this partial class in the file to eliminate the error, the same error points to other file from these 7 after compilation.为了测试,当我重命名/删除文件中的这个部分 class 以消除错误时,编译后相同的错误指向这7个文件中的其他文件。
Image below shows Properties window of the project下图显示了项目的属性 window
My colleague found solution.我的同事找到了解决方案。 The problem is hidden into files问题隐藏在文件中
Properties/Settings.Designer.cs属性/设置.Designer.cs
Properties/Resources.Designer.cs属性/资源.Designer.cs
ClientCore/Properties/Settings.Designer.cs ClientCore/Properties/Settings.Designer.cs
old line旧线
namespace CoreClient.CoreClient.Properties {
new line after fix the problem解决问题后的新行
namespace CoreClient.Properties {
ClientCore/Properties/Resources.Designer.cs ClientCore/Properties/Resources.Designer.cs
old line旧线
namespace CoreClient.CoreClient.Properties {
...
...
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CoreClient.CoreClient.Properties.Resources", typeof(Resources).Assembly);
new line after fix the problem解决问题后的新行
namespace CoreClient.Properties {
...
...
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CoreClient.ClientCore.Properties.Resources", typeof(Resources).Assembly);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.