“Add as Link” for folders in Visual Studio project

2019-01-12 16:44发布

In Visual Studio, we can "Add as link" to add a link to a file in another project in the solution.

Is there any way to do this for entire folders, so that an entire folder in project A will be visible in project B, without the need to manually link to new items in that folder?

7条回答
forever°为你锁心
2楼-- · 2019-01-12 17:17

Bust out the shell and add a symbolic link.

runas Administrator then

mklink /d LinkToDirectory DirectoryThatIsLinkedTo

BAM symbolic link!

/d specifies directory link.

Works in Vista on up out of the box. Can be backported to XP.

Documentation here: http://technet.microsoft.com/en-us/library/cc753194%28WS.10%29.aspx

For those not familiar with symbolic links, it's essentially a pointer to another file or directory. It's transparent to applications. One copy on disk, several ways to address it. You can also make a "hard link" which is not a pointer to another address, but an actual file ID entry in NTFS for the same file.

NOTE: as stated in the comments, this would only work on the computer where you created the symlink and wouldn't work in a Version Control System like git.

查看更多
登录 后发表回答