During xunit.runner.visualstudio version <=2.4.1
, it already contains a dependency Microsoft.NET.Test.Sdk
, and the later version 2.4.2
and 2.4.3
has removed such dependency Microsoft.NET.Test.Sdk
.
also, not sure whether the issue is caused by the update of VS which requires such package recently. And from the default xunit
template project, it contains the package Microsoft.NET.Test.Sdk
by default. So I think VS requires this package.
Maybe in some specific cases, no error will be reported without this package, but there will be no accidental errors in the follow-up, so install this package.
Besides, not sure whether you have install the xunit.runner.visualstudio
version <= 2.4.1
which already has such package, and then update this package later during the VS Update.
Suggestion
1), try to reinstall xunit.runner.visualstudio
nuget package, first uninstall it and then install the version 2.4.1
.
Then, close VS Instance, delete .vs
hidden folder under the solution folder, bin
and obj
folder.
2) try to change the target framework version of your project(it will install any default nuget packages based on the target framework version).
Right-click on your project Properties-->Application--> change target framework to anyone else first and then change it back to the original one.
In addition, if these do not work, you should share a sample of your project with us and provide more detailed info so that it will help us troubleshoot the issue more quickly.
Update 1
For your updated issue, or you could install the nuget package Microsoft.NET.Test.Sdk directly on your project.
Or change your project target framework to net core
.
Use this in csproj file:
<TargetFramework>netcoreapp3.1</TargetFramework>
Then, rebuild your project and you can see the dependency under it.
xunit.runner.visualstudio 2.4.1
? If not, you should update the package to use2.4.1
version. – Leitmotivnet core 3.1
project? – Leitmotivxunit.runner.visualstudio
v2.4.1. The project is a .net framework project – CoagulateMicrosoft.NET.Test.Sdk
. Besides, the mainstream xunit projects are all based onnet core
rather thannet framework
. Also, I wonder what is your previous vs version. Perhaps there is a big gap between them. Since the latest VS IDE, it actually require that nuget package and your project is net framework, the nugetxunit.runner.visualstudio 2.4.1
will not install that dependencyMicrosoft.NET.Test.Sdk
unless your project is based onnet core
. So the error arises. – Leitmotivxunit.runner.visualstudio
for various target frameworks. Though not answering the question. I assures me I had no missing dependencies the whole time. I think it's VS, which started to ask for it explicitly. – Coagulatenetcoreapp3.1
. Use like this<TargetFramework>netcoreapp3.1</TargetFramework>
. Then rebuild your project, I think you will see the dependency under it. – LeitmotivMicrosoft.NET.Test.Sdk
directly. I have updated my answer. – Leitmotiv