很多时候,我看到Visual Studio解决方案具有多个共享源文件的项目.这些常见的源文件通常位于公共目录中,在解决方案资源管理器中,其图标显示在左下方,并带有链接箭头.
Many times I have seen Visual Studio solutions which have multiple projects that share source files. These common source files are usually out in a common directory and in the solution explorer their icon shows up with a link arrow in the bottom left.
但是,每当我尝试将源文件添加到该项目的主目录之外的项目时,它只会自动将其复制到该目录中,这样我就不再拥有共享副本了.
However, any time I try to add a source file to the project that is outside of that project's main directory, it just automatically copies it into the directory so that I no longer have a shared copy.
我发现可以通过在文本编辑器中手动打开项目文件并将路径修改为"../../../Common/Source.cs"之类的方法来解决此问题,但这更多的是hack,那么我想要.
I found that I can get around this by manually opening the project file in a text editor and modifying the path to something like "../../../Common/Source.cs" but this is more of a hack then I would like.
是否存在可以更改的设置或可以在IDE中进行的设置?
Is there a setting or something I can change that will allow me to do this from within the IDE?
推荐答案右键单击项目,选择添加->现有项->添加为链接(按添加"按钮上的小箭头)
Right click on a project, select Add->Existing Item->Add as link (press on small arrow on Add button)
更多推荐
Visual Studio解决方案中的常见文件
发布评论