By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,529 Members | 1,860 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,529 IT Pros & Developers. It's quick & easy.

Resource file problem with VS2005 debugger

P: n/a
GT
This question has been posted before, but without any response so therefore
I'm trying once more.
I'm trying to embed .resource files into a Windows application in VS2005,
and then compile and run the program from VS2005. This does not work because
the debugger seems not find the resource files, and I keep getting the
following error:

"MissingManifestResourceException:
Could not find any resources appropriate for the specified culture (or the
neutral culture) on disk. baseName: String locationInfo: <null fileName:
String.resources"

The code does however work when using the Command Line Compiler, and
lauching the application from the command window.
What is the reason for this?
Are there some special settings in VS2005 that I'm missing?

My example code is very simple and can be tested doing the following:

1) Open a new Project in VS2005: Visual C#>Windows>Windows Application
2) Delete Form1.cs
3) Replace the Main method of Program.cs with the following code:

CultureInfo ci = new CultureInfo("de-DE");
Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
ResourceManager rm = ResourceManager.CreateFileBasedResourceManager
("String", "de-DE", null);
Console.WriteLine(rm.GetString("wednesday", ci));

4) Add the using statements
using System.Resources;
using System.Threading;
using System.Globalization;
using System.Reflection;

5)Add a new folder "de-DE" and add a text file named 'String.de-DE.txt' to
the folder

6)Open 'String.de-DE.txt' and write 'wednesday=Mitwoch'

7)Open the VS Command Window and locate the de-DE folder. Then use
resgen.exe to generate a .resource file by writing 'resgen String.de-DE.txt'.

8) Type 'cd..'

9) Compile the solution with the Command Line Compiler writing
'csc /res:de-DE\String.de-DE.resources *.cs'

10) Run the example by typing 'Program'. This should will display 'Mitwoch'
in the command window

Now try to debug and run the application from Visual Studio 2005 (F5). This
will cause the above mentioned error. Why?

Aug 2 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.