Visual Studio解决方案中的常见文件

编程入门 行业动态 更新时间:2024-10-19 22:36:37
本文介绍了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解决方案中的常见文件

本文发布于:2023-11-13 14:42:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584607.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   常见   文件   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!