Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Resources (resx) doesn't work after migration to .NET 4.5

a installed Visual Studio 2012 and migrate my Web Apps to .NET 4.5. I had many resx files in App_GlobalResources and always it works.

After migration resx files generates in designer "namespace MyApp.App_GlobalResources" instead of "namespace Resources".

I solved this with rename App_GlobalResources to "Resources" and change custom tool from "GlobalResourceProxyGenerator" to "PublicResXFileCodeGenerator".

But it doesn't work with expression e.g.: <%$ Resources: Users, LoginTitle %>

Thanks for advice

like image 692
Jan Remunda Avatar asked Oct 24 '12 07:10

Jan Remunda


People also ask

How do you regenerate a RESX file?

resx file? If so, go to project properties, then the "Resources" tab, and there should be a big link to click to regenerate it.

What is resources Resx?

The . resx resource file format consists of XML entries that specify objects and strings inside XML tags. One advantage of a . resx file is that when opened with a text editor (such as Notepad) it can be written to, parsed, and manipulated.

Are RESX files compiled?

resx files are compiled into binary . resources files.


2 Answers

Although I changed Custom Tool to : PublicResXFileCodeGenerator, I dont know if it worked for me.

The main issue is - In my case, when I built my MVC 3 project on Visual Studio 2012, it made namespace "Resources" for the .resx files.

As in Visual Studio 2010, it was under namespace "App_GlobalResources".

I renamed the namespace under designer.cs for the Resource files back to "App_GlobalResources", and it worked for me.

like image 150
Lakshay Avatar answered Oct 30 '22 07:10

Lakshay


I found this article. Now it works

I've set custom tool to : PublicResXFileCodeGenerator

custom tool namespace to: Resources

and build action: Embeded Resource

like image 25
Jan Remunda Avatar answered Oct 30 '22 07:10

Jan Remunda