简体   繁体   English

如何从csproj项目文件中正确删除NUnit3TestAdapter

[英]How to correctly remove NUnit3TestAdapter from csproj project file

I changed the unit testing of a C# test project from NUnit to xUnit. 我将C#测试项目的单元测试从NUnit更改为xUnit。 I already removed the NUnit nuget package. 我已经删除了NUnit nuget包。 But when I look into the csproj file there still the NUnit3TestAdapter is there: 但是当我查看csproj文件时,仍然还有NUnit3TestAdapter:

<Import Project="..\..\..\..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props" Condition="Exists('..\..\..\..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props')" />
...
<Error Condition="!Exists('..\..\..\..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\NUnit3TestAdapter.3.10.0\build\net35\NUnit3TestAdapter.props'))" />

I dont see this in the nuget package manager. 我在nuget包管理器中看不到这一点。

So my question: How to remove this correctly? 所以我的问题是:如何正确删除它? Should I edit the file manually or is there a way to remove it with VS2017? 我应该手动编辑文件还是可以通过VS2017删除文件?

Edit: I removed these two lines manually from csproj file. 编辑:我从csproj文件中手动删除了这两行。 It seems fine. 好像还好

You can manually edit your .csproj file and remove unused references. 您可以手动编辑.csproj文件并删除未使用的引用。 Just be sure to save an old copy in case you accidentally corrupt the XML. 只要确保保存一个旧副本,以防意外损坏XML。

You might also want to check your packages folder and make sure the package folder is removed, in addition to checking packages.config file and making sure the reference is removed there too. 除了检查packages.config文件并确保在那里也删除了引用之外,您可能还需要检查您的packages文件夹并确保已删除package文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM