.net 是否可以在 Visual Studio 中将引用从一个项目复制/粘贴到另一个项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8742334/
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-09-03 16:09:33  来源:igfitidea点击:

Is it possible to copy / paste References from one project to another in Visual Studio?

.netvisual-studioresharper

提问by pencilCake

Is there a way or tool that lets you to copy some references from one project and paste them to another -so that I do not bother my self again by using ADD REFERENCE?

有没有一种方法或工具可以让您从一个项目中复制一些引用并将它们粘贴到另一个项目中 - 这样我就不会再次使用 ADD REFERENCE 来打扰我自己?

采纳答案by Damyan Bogoev

Yes, you could use the Power Commandsextension to copy and paste references in VS2010.

是的,您可以使用Power Commands扩展在 VS2010 中复制和粘贴引用。

回答by Clayton Hall

I had the same question in Visual Studio 2013 Preview. I couldn't find any "Power Commands" extensions yet, so I did it manually.

我在 Visual Studio 2013 预览版中遇到了同样的问题。我还没有找到任何“电源命令”扩展,所以我手动完成了。

  1. Unload the source project.
  2. Edit
  3. Copy contents of tag tag that lists the tags.
  4. Unload the target project
  5. Edit
  6. Find the tag and paste
  7. Load the projects.
  1. 卸载源项目。
  2. 编辑
  3. 复制列出标签的标签标签的内容。
  4. 卸载目标项目
  5. 编辑
  6. 找到标签并粘贴
  7. 加载项目。

回答by Sam K

Simple Solution - For External Libraries

简单的解决方案 - 用于外部库

  1. Click add references.

  2. Click Browse.

  3. Navigate to the folder containing the other project. Then, go to /project-name/bin/debug.

  4. Highlight the desired dll's and then click add.

  1. 单击添加引用。

  2. 单击浏览。

  3. 导航到包含其他项目的文件夹。然后,转到 /project-name/bin/debug

  4. 突出显示所需的 dll,然后单击添加。

回答by Yurrit Avonds

If you do not have access to PowerCommands, try opening the .csprojfiles of both projects in an (advanced) text editor. The .csprojfiles are XML files.

如果您无权访问 PowerCommands,请尝试.csproj在(高级)文本编辑器中打开两个项目的文件。这些.csproj文件是 XML 文件。

Look for the <itemgroup>subsection that contains a number of <reference>tags. Copy the <reference>tags corresponding to the references you wish to copy from the source .csprojfile to the corresponding <itemgroup>subsection in the target .csprojfile.

查找<itemgroup>包含多个<reference>标签的小节。将与<reference>您希望从源.csproj文件复制的引用对应的标签复制到<itemgroup>目标.csproj文件中的相应子部分。

If the target project was opened in Visuals Studio while you did this, VS will notice that the .csprojfile has been altered and will ask you to reload the file, click 'Yes' to do so and verify that the references have been added to the reference list.

如果在执行此操作时在 Visuals Studio 中打开了目标项目,VS 会注意到该.csproj文件已被更改,并会要求您重新加载该文件,单击“是”以执行此操作并验证是否已将引用添加到引用中列表。

回答by Manuel Rauber

Right click on the reference (you can select more than once) -> Copy Reference.

右键单击引用(您可以选择多次)-> 复制引用。

Change Project / VS. Right-Click on "References" -> Paste Reference

更改项目/VS。右键单击“参考”-> 粘贴参考

But you will need Powercommands for that.

但是您将需要 Powercommands。

回答by VS1

I think its possible in Visual Studio 2010, just highlight the references you want to copy, right click and select 'Copy References' from the menu..and then go to the other project, right click the References item and select 'Paste References'..

我认为它可能在Visual Studio 2010..