visual-studio 如何从 Visual Studio 中的网站项目中删除项目引用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3300189/
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
How do I remove a project reference from a website project in Visual Studio?
提问by David
So, if I have website project Foo which has a reference to class library project Bar, how do I remove that reference?
因此,如果我有一个引用类库项目 Bar 的网站项目 Foo,我该如何删除该引用?
回答by Matt Peterson
The reference is stored in the Visual Studio solution file.
该引用存储在 Visual Studio 解决方案文件中。
Right-click on the web site's project item in Solution Explorer and choose "Property Pages". The first item on the dialog that comes up is "References". You can add/remove references from here.
在解决方案资源管理器中右键单击网站的项目项,然后选择“属性页”。出现的对话框中的第一项是“参考”。您可以从此处添加/删除引用。
Edit:
编辑:
I should mention that this is in Visual Studio 2010. I don't have any other versions installed at the moment, so I can't verify that this works for them as well.
我应该提到这是在 Visual Studio 2010 中。我目前没有安装任何其他版本,所以我无法验证这是否也适用于他们。
回答by Sam
Here's how I did it for Visual Studio 2017.
这是我为 Visual Studio 2017 所做的。
- Close the solution in Visual Studio
- Open the solution file (
.sln) in a text editor - Locate the website project:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "YOUR-WEBSITE-NAME" - Locate the
ProjectReferencesproperty under the project - The reference you want to delete might look like
{03D389EB-38E0-4D71-86EF-E2ABCFB4AE21}|REFERENCE-TO-REMOVE.dll; - Delete it from within the string, including the semicolon
- 在 Visual Studio 中关闭解决方案
.sln在文本编辑器中打开解决方案文件 ( )- 找到网站项目:
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "YOUR-WEBSITE-NAME" - 找到
ProjectReferences项目下的属性 - 您要删除的引用可能看起来像
{03D389EB-38E0-4D71-86EF-E2ABCFB4AE21}|REFERENCE-TO-REMOVE.dll; - 从字符串中删除它,包括分号
回答by MC9000
There's a bug in all versions of Visual Studio 2005-2010 that make you think you are deleting a project reference, but when you try to add the reference back, it says it already exists. Solution: delete the solution file (SLN) and re-add all the projects back. This is the ONLY solution that works unless you can edit the solution file directly (which almost never works).
Visual Studio 2005-2010 的所有版本中都有一个错误,让您认为您正在删除项目引用,但是当您尝试添加引用时,它说它已经存在。解决方案:删除解决方案文件(SLN)并重新添加所有项目。这是唯一有效的解决方案,除非您可以直接编辑解决方案文件(这几乎永远不会奏效)。
回答by Arindam Nayak
In VS 2013, there is no direct option, you have to delete all dlls in bin/debug , and clean, re build solution, you are done.
在 VS 2013 中,没有直接选项,您必须删除 bin/debug 中的所有 dll,并清理,重新构建解决方案,您就完成了。
回答by MCain
In Solution Explorer, Right-click on the project. In this view, go to References, and remove the offending reference.
在解决方案资源管理器中,右键单击项目。在此视图中,转到引用,并删除有问题的引用。
回答by Ben Franklin
I had the same problem in 2008 but removing the reference didn't work, it just kept coming back. I ended up editing the solution file in notepad and removing the reference manually.
我在 2008 年遇到了同样的问题,但删除引用不起作用,它只是不断地回来。我最终在记事本中编辑了解决方案文件并手动删除了参考。

