(Visual Studio) linked files gotchas: how do I link to a file?
I'll start a series of gotchas on linked files, but first of all, how do I link a file, and why would I want to link a file?
to link a file:
from solution explorer
- right click on your project
- Add existing item
- find the file you want to add
- instead of clicking on the Open button, click on the little arrow on the open button, then select "Link file"
a linked file can be very useful for different things, it doesn't copy the file to your project folder, a linked file is just a reference to a file somewhere, the file exists only "virtually" on your project, but it behaves just like if the file was part of the project
I use linked files for my tests, for almost every project now I create another project "TestCases" and I link to the source files of the main project to be able to test individual functions of the classes of the main project, it makes life a lot easier (especially when making changes)
however there are some gotchas about linked files, I will post the ones I have been faced with so far