Visual Studio - how can BULK add files to a given directory as LINK?

How can I add to Visual Studio all the files under a specific directory “as a link” (that is, without creating Visual Studio in the local directory of the project, what happens if you add the folder as an “existing element”)?

In my case, I do not want local copies. Instead, I want to work with existing elements in their original places. And I do not want to add them, browsing each folder. Instead, I want to specify this folder and press the button of the magic silver bullet, which will add all the files under it as a “link”.

Thanks in advance.

(Disclaimer - I reviewed related issues, but all of them lead to the creation of VS local copies.)

+3
source share
3 answers

For individual files

in the Add Item dialog box, you'll see a small arrow pointing down to the add button

click it (since it is a drop-down button) and select add as a link menu item. which will add the item as a link

For multiple files

in the dialog for adding existing elements, SELECT all the files that you want to add as a link and click on the menu item to add the add button as a link

For multiple files in multiple locations

If you want to select a folder and add all items to all subfolders, you can do it this way

, , " ".

, ( ) Visual Studio - BULK LINK? , , , , - .

,

Dan

+6

" " , , , " ".

+1

If you want the files under the external directory to be automatically synchronized in your Visual Studio project (i.e. any new files are added to the solution explorer and deleted ones are deleted), you can specify a wildcard in the link. To do this, you will need to manually edit the project file (.csproj, .vbproj).

Find the section in the file where the ItemGroup elements are located, and add something like this:

  <ItemGroup>
    <Content Include="..\MyDirectory\*.*" />
  </ItemGroup>

This will automatically add all files to MyDirectory (one level above the project).

+1
source

Source: https://habr.com/ru/post/1718807/


All Articles