Dabloons
Dabloons

Reputation: 1502

Reference a resource to be copied at build time

In Visual Studio, I can add a resource (text file, image, etc.) to the project and have it copy to the output directory at build time. The problem with this is that the project copies the file into the project directory. I have a multi-project solution where many projects are referencing the same resource, I don't want the resource copied into every project directory. I want the resource to stay in a separate resource directory that I have under source control with the rest of the solution. Is there a way for me to add the resource to the projects and have the projects copy the resource to the debug and release directories on build that wouldn't force the file into the project directory?

Upvotes: 1

Views: 110

Answers (2)

daryal
daryal

Reputation: 14919

In project explorer select the folder or project where you want to add the file and right click. Select Add Existing Item from menu.

Locate the file and click on the arrow near the Add button. From the menu opened, select Add As Link.

Do not forget to change the properties of the linked item (Copy To Output directory etc).

Upvotes: 2

Nicole Calinoiu
Nicole Calinoiu

Reputation: 20992

You should be able to link the files into your projects instead of copying them. See http://support.microsoft.com/kb/306234 for steps.

Upvotes: 1

Related Questions