How to relocate source files in Visual Studio?
-
07-02-2021 - |
質問
Consider the following directory structure:
MyProject\VS2010\myproject.sln
MyProject\VS2010\myproject.csproj
MyProject\src\SourceFile1.cs
MyProject\src\SourceFile2.cs
When I add a new file to solution in Visual Studio, it is added to VS2010
folder, however I would like all my source files to be in src
folder. The only way I know is to unload the project in Visual Studio, move the files manually, then edit .csproj
file to point to the new location.
I was wondering if there is a better way to do this.
解決
It turns out that you can add files to your project without copying them by pressing a little arrow on Add
button in Add Existing Item
dialog and selecting Add as a link
. This will add a file to your project leaving it where it is.
所属していません StackOverflow