Visual Studio解决方案中的常见文件 [英] Common Files in Visual Studio Solution

查看:105
本文介绍了Visual Studio解决方案中的常见文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很多时候,我看到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解决方案中的常见文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆