views:

67

answers:

4

I've got a folder of files I'd like to add to my project resource file (Resources.resx). Normally, when I add files, they are copied into the project directory.

Is there any way I can tell Visual Studio to not copy them, but instead reference them using relative paths? Relative paths work when I edit the resource file manually, but I'd like an automatic solution, if possible.

Any ideas?

+1  A: 

I don't think this is possible out-of-the-box in VS2008.

I even remember someone asking a very similar question on stackoverflow, possibly the same even, and was given the same answer.

You can probably write a macro that can do this though.

gillyb
A: 

I don't know for sure about resx, but when you add a file in Visual Studio (at least in .NET/C#), you can add it via a link by clicking the drop-down arrow on the right side of the "Add" button in the add existing file dialog. Then, edit the properties on the file to include the resource as you normally would.

Merlyn Morgan-Graham
+1  A: 

This Code Project Article discusses how to use the .net RESGEN command line utility to create resource files. You could write a batch that creates an assembly with your resources in it.

Carter
A: 

You don't have to edit manually - that's why you have regexp. Just don't drag and drop - causes repetitive strain injury :-))) Seriously, you may have to let VS create that file at the beginning, but after that - strict text editor policy. Saves a lot of grief down the line.

As the commend bellow said - manual editing for hundreds of files is impractical - but writing a PowerShell script or a C# snippet to construct it isn't. The more files you have the stronger reason to script this. It will save you time even the first time around and latter you might even start using it as a part of the build.

If you have a good editor and no time for a script immediately you can also just do a recursive dir of wherever your files are and literally construct good part of Resx with a few regex-es.

ZXX
For hundreds of files in different directories, editing the resx files manually is impractical.
Charlie Salts