Mladen Prajdić Blog

Blog about stuff and things and stuff. Mostly about SQL server and .Net

Adding one file to multiple projects in a .Net solution

There are times when you want to have one .cs file in multiple projects. However if you do Add existing item you’ll notice that the file is copied to each project’s folder. This is not what we want.

The solutions is of course pretty simple once you know where to look. In the Add existing item dialog you have to add the file as a Link as is shown on the picture:

 

AddCommonItem

And there you go. you can have one file in multiple projects.

kick it on DotNetKicks.com

Legacy Comments


Bojan Vrhovnik
2009-06-07
re: Adding one file to multiple projects in a .Net solution
:) guess, never thought on checking what combo button does on Add Button...nice discovery... :)

Simi Sreedharan
2009-07-12
re: Adding one file to multiple projects in a .Net solution
Thanks for this tip