Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Microsoft.NET.Test.Sdk need for Unit Test Project (.NET Framework) #2422

Closed
AaqibAhamed opened this issue May 3, 2020 · 7 comments
Closed

Comments

@AaqibAhamed
Copy link

AaqibAhamed commented May 3, 2020

Description

I have created created Unit Test Project (.NET Framework) to my project.Does Microsoft.NET.Test.Sdk need for Unit Test Project (.NET Framework) in any ways?

Steps to reproduce

Can I delete it from my project? Is this fine always ?.

Expected behavior

Test should run perfectly without any issues or warnings.

Actual behavior

Diagnostic logs

Environment

Entity Framework v4.5

@plioi
Copy link
Contributor

plioi commented May 3, 2020

Although this package is technically not necessary, the things it does to your project are necessary for Test Explorer and dotnet test to work. If you don't use Test Explorer or dotnet test, you can leave it out.

Most test frameworks' nuget packages don't list it as an automatic dependency, so in practice you do have to remember to include it, otherwise you'll get confusing error messages when you try to run tests. Also, you have to hope that the version you choose is truly compatible with your selected test framework. The package moves quickly, so version-to-version compatibility is a challenge.

Beware. The package actively interferes with the system under test (#2279, #2316), an unfortunate side effect of VSTest's own implementation details being copied over your own build output folder every time you build.

@AaqibAhamed
Copy link
Author

But It supports only for Visual Studio Enterprise edition right?.

@plioi
Copy link
Contributor

plioi commented May 5, 2020

It's for everyone. I use it in Community edition all the time.

@binhtq1987
Copy link

hi plioi,

I have a concern would like to ask you. I did not install the package Microsoft.Net.Test.Sdk, but Test Explorer also works fine for me. not sure how it work, can you help me to understand this?

image

@plioi
Copy link
Contributor

plioi commented Jun 14, 2020

Looks like your project is targeting .NET 4.5.2, the "regular old" framework. The rules are simply different for that. I believe Microsoft.Net.Test.Sdk started to show up as something end users had to deal with after .NET Core arrived. VsTest has different code for .NET Framework and was probably able to make more assumptions on its own about how things worked.

@binhtq1987
Copy link

Thanks Patrick!

@nohwnd
Copy link
Member

nohwnd commented Jun 15, 2020

As Patrick says, testhost (the component that runs your tests) is a dependency of Test.SDK, and on netcore projects is delivered by nuget. On .NET Framework it uses the same component that is shipped with SDK (and Visual Studio) together with vstest.console.

@Sanan07 Sanan07 closed this as completed Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants