Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio - Resx File default 'internal' to 'public'

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 {...}  } 

I need all those internal to be public all the time.

like image 976
Robin Maben Avatar asked Nov 25 '10 06:11

Robin Maben


People also ask

How do I make Resx public?

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. Edit: 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.

What is RESX file in Visual Studio?

resx) files are a monolingual file format used in Microsoft . Net Applications. The . resx resource file format consists of XML entries, which specify objects and strings inside XML tags.

Are RESX files compiled?

resx file is compiled into a . resource file, which in turn is linked into a . resource. dll satellite file, referred to as a satellite DLL or Language Assembly.

How do I make a ResX file public?

Instead of the ResXFileCodeGenerator, use the PublicResXFileCodeGenerator. 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. Edit: Alternatetively you can set the Access Modifier to public when you open the resx file in Visual Studio.

How do I use a ResX file in Visual Studio?

There are also ways to work with .resx files other than programmatically. When you add a resource file to a Visual Studio project, Visual Studio provides an interface for creating and maintaining a .resx file, and automatically converts the .resx file to a .resources file at compile time.

What is a resource file in Visual Studio?

At compile time, Visual Studio first converts the .resx files in a project to binary resource (.resources) files and stores them in a subdirectory of the project's obj directory. Visual Studio embeds any resource files that do not contain localized resources in the main assembly that is generated by the project.

How to resolve the value of staticextension in ResX?

StaticExtension value cannot be resolved to an enumeration, static field, or static property. It's caused by the internal modifier and the solution is to change it to public. However, we can't do that directly because Visual Studio overwrites Design.cs file after any changes in ResX one. So, first, let's take a look at the properties of ResX file:


2 Answers

Instead of the ResXFileCodeGenerator, use the PublicResXFileCodeGenerator.

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.

Edit: 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.

like image 109
Anton Avatar answered Oct 08 '22 15:10

Anton


  1. Right click on Resource file ( resource.resx ) => Properties.

  2. Custom Tool => Change to PublicResXFileCodeGenerator

like image 43
Rohan K Avatar answered Oct 08 '22 16:10

Rohan K