Visual Studio中 - 的Resx文件默认的“内部”到“大众”大众、文件、Visual、Studio

2023-09-02 01:52:15 作者:若有来世,别再负我

我编辑VS资源文件时,它都会重新生成相应的code和设置类访问修饰符内部。 这是一个痛苦的使用Ctrl-F - 每次我编辑RESX时间>的replaceAll。是否有一个属性/设置,以便我可以默认这种公众?

Every time I edit a resource file in VS, it regenerates the corresponding code and sets the class access modifier to internal. It's a pain to Ctrl-F -> ReplaceAll every time I edit the resx. Is there a property/setting so that I can default this to public?

internal class MyResource {

     internal static global::System.Resources.ResourceManager ResourceManager {...}

}

我需要所有这些内部公开所有的时间。

推荐答案

相反,ResXFile codeGenerator的,使用PublicResXFile codeGenerator。

Instead of the ResXFileCodeGenerator, use the PublicResXFileCodeGenerator.

您可以通过设置这是在属性窗口中的自定义工具属性你想公开访问的Resx文件做到这一点。

You can do this by setting this as the Custom Tool property in the Property Window for the Resx file you want public access to.

编辑:Alternatetively当您打开Visual Studio中的RESX文件,您可以设置访问修饰符公众。访问修饰符下拉框可以在表单的顶部找到。

Alternatetively you can set the Access Modifier to public when you open the resx file in Visual Studio. The Access Modifier dropdown box can be found at the top of the form.