I have written a VERY simple MVC application which just displays a single string from a Resource file. It works just fine on my local machine but when I deploy the project to the web server I get the error.
CS0103: The name 'Resources' does not exist in the current context
You can very easily replicate exactly what I am doing in just 10 steps!
Create a New MVC 2 Web Application.
(File->New->Project->ASP.NET MVC 2 Web Application, say no to the Unit Testing Project)Add the "App_GlobalResources" folder.
(right click the project and select Add->Add ASP.NET Folder->App_GlobalResources)Add a Resource File to this folder.
(right click the folder and select Add->New Item...->Resources File. Name it Strings.resx)Add a single string to the Resource table.
(Name = "HelloWorld", Value = "I localized Hello World!")Set the File Properties for the Resource File.
(Click the file Strings.resx and int the Properties window set Build Action = "Embedded Resource" and the CustomTool = "PublicResXFileCodeGenerator")Add a new Controller
(Right click the Controllers folder and select Add->Controller... Name it HelloWorldController.cs)Add a the View
(With the cursor in the Index method of the HelloWorldController.cs Press CTRL-M-V. Use the default values including View name = "Index")Modify the View so that it displays our string from the resource file.
Replace the content of the MainContent placeholder with<h2><%: Resources.Strings.HelloWorld %></h2>
Run it locally to test that it works. Which it should.
Publish it to a web server and visit the url "http://localhost/HelloWorld"
This is where I see the error described at the top.
I would imagine that the settings I've put on the ResX file are incorrect and the resource is not published to the server.
Help is greatly appreciated.
Thanks!