我在 FxCop 中违反了以下规定。当我在 Console.WriteLine("Service Started");
Method 'method()' passes a literal string as parameter 'value' of a call to 'Console.WriteLine(string)'. Retrieve the following string(s) from a resource table instead: "Service Started"
所以我更改了如下类型的代码。
ResourceManager rm = new ResourceManager("Service Started", Assembly.GetExecutingAssembly());
string start = rm.GetString("Service Started");
Console.WriteLine(start);
现在我没有违反 FxCop。但是我在行 string start = rm.GetString("Service Started");
如何解决这个异常?
Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Service Started.resources" was correctly embedded or linked into assembly "namespace name" at compile time, or that all the satellite assemblies required are loadable and fully signed.
最佳答案
看来您可能没有添加资源字符串和值。请验证以下链接以供引用:
关于c# - CA1303 从资源表中检索以下字符串而不是 : "Service Started",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43861367/