.NET Tip of The Day
Learn one new .NET trick every day
Login or Join
.NET Tips & Tricks Community RSS

Those who prefer reading this site through RSS now can also subscribe for updates to .NET Tips & Tricks Community.

Linking a file in Visual Studio.NET

If in VS.NET you add to the current project an existing file that's located outside the current project's directory, the file is first copied in the project's directory, and then it's added to the project. However, you may want to share the same source file among multiple projects. As a trivially simple example, perhaps you get tired of specifying the same AssemblyCompany and AssemblyCopyright strings, over and over again, in all your projects? Wouldn't it be nice to have a little two-line C# file tucked away somewhere, and include it by reference in all your projects?

[assembly: System.Reflection.AssemblyCompany(".NET Tip of The Day.org")]

[assembly: System.Reflection.AssemblyCopyright("© 2007 All rights reserved.")]

To add a shared file, open the dialog to select an existing file with the Project | Add Existing Item… menu item and select the file you want to include. Then, instead of clicking the Open button, click the arrow on the left of that button, and click Link File from the list that drops down. This way you link to the original file, not to a local copy of it.

8/22/2007
RSS .NET Tip of The Day
Subscribe to receive one tip from the .NET Tips and Tricks Community per day.
Previous Tips of The Day
The best of the .NET Tips & Tricks Community.
.NET Practitioners .NET Tips & Tricks Community
Every .NET practitioner has a trick up in their sleeve. This is the place to share it with other .NET people.
Submit a Tip
Discovered a new trick? Share it with others.
My Tips
Manage tips you authored.