更新时间:2022-05-18 03:35:47
解决此问题所需要做的就是右键单击解决方案资源管理器中的Resources.resx
文件,然后单击运行自定义工具.重新生成自动生成的Resources.Designer.cs
文件.
All I needed to do to fix this problem was to right-click the Resources.resx
file in the Solution Explorer and click Run Custom Tool. This re-generates the auto-generated Resources.Designer.cs
file.
如果.resx文件是手动添加到项目中的,则该文件的自定义工具"属性必须设置为"ResXFileCodeGenerator".
If the .resx file was added to the project manually, the Custom Tool property of the file must be set to "ResXFileCodeGenerator".
问题是由于名称空间不匹配引起的,如果您在项目设置中更改了程序集的默认名称空间",则会发生此问题. (我将其从(以前)"Servers"
更改为(现在)"RT.Servers"
.)
The problem is due to a mismatch of namespaces, which occurs if you change the "default namespace" of the assembly in the project settings. (I changed it from (previously) "Servers"
to (now) "RT.Servers"
.)
在Resources.Designer.cs
中自动生成的代码中,有以下代码:
In the auto-generated code in Resources.Designer.cs
, there is the following code:
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Servers.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
文字字符串"Servers.Resources"
必须更改为"RT.Servers.Resources"
.我是手动完成的,但是运行自定义工具也可以做到.
The literal string "Servers.Resources"
had to be changed to "RT.Servers.Resources"
. I did this manually, but running the custom tool would have equally well done it.