Search code examples
c#asp.netresx

How to change the namespace of a resource file in ASP.NET Core?


At this moment the default namespace for resources (resx files) is ProjectName.Resources.

I would like to change this default to being just Resources.

enter image description here

What I have tried to do here is manually change the namespace in Address.Designer.cs. While that seems to work at first, the default is reset after changing one of the values in the resx file.

How can this be done?


Solution

  • It seems you cannot change the namespace as easily as it was in old ASP.NET projects just by changing the Custom Tool Namespace in the properties section of a resx file. Simplest thing you can do is create a Class Library project named Resources in your solution and add Address.resx to it. Then change its Access Modifier to Public.

    enter image description here