visual-studio 如何创建 Visual Studio 快捷方式文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1458301/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:02:01  来源:igfitidea点击:

How do I create Visual Studio shortcut files

visual-studioshortcut

提问by Matthew Kruskamp

In Visual Studio there is a way to have a file in another project that is a shortcut to the first so that it builds in both. How do I do that?

在 Visual Studio 中,有一种方法可以将另一个项目中的文件作为第一个项目的快捷方式,以便在两者中构建。我怎么做?

回答by itowlson

Right-click the project, select Add > Existing Item, and in the dialog drop down the Add button and select Add As Link.

右键单击项目,选择添加 > 现有项目,然后在对话框中下拉添加按钮并选择添加为链接。

Add As Link

添加为链接

回答by UuDdLrLrSs

This is not a direct answer but an alternative that may be worth considering in some cases.

这不是直接的答案,而是在某些情况下可能值得考虑的替代方案。

You can create a specific kind of project which can "include" a set of files in another project when it is added by reference. This is called a Shared Projectwhich is one of the 'new project' options:

您可以创建特定类型的项目,当它通过引用添加时,该项目可以“包含”另一个项目中的一组文件。这称为共享项目,它是“新项目”选项之一:

enter image description here

在此处输入图片说明

(Since at least Visual Studio 2015 - maybe earlier).

(至少从 Visual Studio 2015 开始 - 可能更早)。

One advantage of this type of project over individual shortcuts is that it includes a set of things as a bundle. So if you have a large # of items, this may be easier and less error prone.

与单个快捷方式相比​​,这种类型的项目的一个优点是它包含一组作为捆绑的东西。因此,如果您有大量项目,这可能会更容易且不易出错。

Also it uses the familiar "reference" metahphor in the context of the solution and in that way functions quite similarly to other project references; the difference is that in a shared project the items in the project are added into each referring project, but in a normal project the assemblies (DLLs) end up owning the reference at runtime. Shortcuts may be less familiar to other developers than the reference pattern.

此外,它在解决方案的上下文中使用了熟悉的“引用”隐喻,因此其功能与其他项目引用非常相似;不同之处在于,在共享项目中,项目中的项被添加到每个引用项目中,但在普通项目中,程序集 (DLL) 最终在运行时拥有引用。与参考模式相比,其他开发人员可能不太熟悉快捷方式。

More information: What is the difference between a Shared Project and a Class Library in Visual Studio 2015?

更多信息:Visual Studio 2015 中的共享项目和类库有什么区别?

回答by Szere Dyeri

Are you talking about a solution with multiple projects? In that case answer would be using Project Dependencies (within Project menu).

您是在谈论具有多个项目的解决方案吗?在这种情况下,答案将是使用项目依赖项(在项目菜单中)。