Skip to main content

Sharing files between projects in VS 2008

If you have to share files across projects in VS 2008 all pointing to same file, its quite simple though its kind of hidden.

Consider the case I had - required a database access library for both mobile device and windows app. The class files are same. The only difference are type of project (SmartDevice Class Library and Class Library) and references.

So, create two projects in one solution and had all class files (.cs) in a separate folder called "src" and used "Add Existing Item..." and added them to both projects. Oops! it created copies in each of project folder. If you want them to add the files as a link, don't just double click target file in "Add Dialog", select it and "Add" button has an option to "Add as Link".

So, there you go. Now, both the projects refer to same CS file and its all the more easy now to maintain the source.

PS:
After googling found this link which helped.

Comments