I have a resource file named rs.resx
. In the Visual Studio designer, I can add an image to my resource file by clicking "Add resource" and specifying the path to my image file.
After adding the image, the image file itself is also copied to a folder in my Visual Studio solution named Resources
. I would like all of my image files to be placed in a folder named Images
instead. Is this possible?
This is a little tricky, but it is possible.
VS checks if the file added to a resource is already defined somewhere within your project. If it can't find it, it creates the folder Resources, puts a copy to the file there, adds this file to the project and puts a reference into the resource designer to this fresh copy of your file.
To avoid this behaviour you should add the file to your project before you add it into the resource file. If the file isn't somewhere within your project structure you can just create a folder, right click it, select Add file and before you click on the Add button of the OpenFileDialog, push on the little arrow next to the button and select Add as link.
Now the file resides on the place on your hdd wherever you like and the resource designer doesn't create a copy within your project file if you now add the file within the resource designer.
Maybe this little picture helps to find the Add as link button:
(source: modbusdriver.com)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With