tags:

views:

147

answers:

1

I have an ASP.NET web application with a .resx file in App_GlobalResources whose resources are typically accessed like this:

ASPX: <asp:Literal ID="l1" runat="server" Text="<%$ Resources:GalleryServerPro, Admin_Tab_Hdr %>" />

Code-behind: string msg = Resources.GalleryServerPro.Successfully_Restored_Msg;

Is there any way to compile the .resx values directly into the DLL so that I can deploy the app without the .resx file and not have to edit any of the existing code?

I ask this because I am porting an existing app to a DotNetNuke module and DotNetNuke does not allow .resx files, so I am looking for a workaround.

Thanks, Roger Martin Gallery Server Pro

A: 

You do not need to change your code. You need to look at creating satellite assemblies.

This is covered in better detail in blog postings such as: http://blogs.msdn.com/pedram/archive/2007/08/04/automated-build-of-satellite-assemblies-in-visual-studio-with-msbuild.aspx

Jennifer Zouak
I have spent several hours on this without success. It appears that my use of the declarative syntax in the ASPX page causes the app to become dependent on the .resx file in App_GlobalResources, and it is impossible to refactor this into a satellite assembly. When I try, my app ignores it (continues displaying from the .resx). If I delete the .resx file to try to force it to use it, ASP.NET silently creates a new, empty .resx file and then throws an error because it is empty. If I then delete the App_GlobalResources dir, the w3wp.exe process crashes.
Have you looked at deploying a full compiled application to the web server? You can precompile the site. See http://msdn.microsoft.com/en-us/library/ms229863(VS.80).aspx.When this is done there should be no resx files in the web directory.Quote "These files are compiled into assemblies and placed in the Bin directory. No App_GlobalResources subdirectory is created under the main output directory, and no .resx or .resources files located in the source directory are copied to the output directories."Maybe this tool actually is more what you need than the satellite assemblies procedure?
Jennifer Zouak
Pre-compiling a site is an option only with web sites, not web applications, so that does not work for me.