-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Clarify MSTest.Sdk incompatibility with ASP.NET Core (Microsoft.NET.Sdk.Web) #54554
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
base: main
Are you sure you want to change the base?
Changes from all commits
f4b77fd
45c6fe4
5570994
d4c76c0
0a755d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,9 +23,9 @@ The MSTest runner is open source and builds on the [MTP](./microsoft-testing-pla | |
|
|
||
| ## Enable MTP in an MSTest project | ||
|
|
||
| It's recommended to use [MSTest SDK](./unit-testing-mstest-sdk.md) as it greatly simplifies your project configuration and updating the project, and it ensures a proper alignment of the versions of the platform (MTP) and its extensions. | ||
| Use [MSTest SDK](./unit-testing-mstest-sdk.md) to greatly simplify your project configuration, version management, and alignment of MTP and its extensions. | ||
|
|
||
| When you use `MSTest SDK`, by default you're opted in to using MTP. | ||
| `MSTest.Sdk` replaces `Microsoft.NET.Sdk` as the project SDK, and MTP is enabled by default: | ||
|
|
||
| ```xml | ||
| <Project Sdk="MSTest.Sdk/4.1.0"> | ||
|
|
@@ -39,7 +39,12 @@ When you use `MSTest SDK`, by default you're opted in to using MTP. | |
| </Project> | ||
| ``` | ||
|
|
||
| Alternatively, you can enable MSTest runner by adding the `EnableMSTestRunner` property and setting `OutputType` to `Exe` in your project file. You also need to ensure that you're using `MSTest 3.2.0` or newer. We strongly recommend you update to the latest MSTest version available. | ||
| > [!NOTE] | ||
| > `MSTest.Sdk` works only when your project can use `Microsoft.NET.Sdk` as its base SDK. If your project requires a different SDK, don't replace the `<Project Sdk="...">` value with `MSTest.Sdk`. | ||
| > | ||
| > For example, ASP.NET Core integration test projects use `Microsoft.NET.Sdk.Web`. `MSTest.Sdk` derives from `Microsoft.NET.Sdk`, so it doesn't import the ASP.NET Core SDK targets that `Microsoft.NET.Sdk.Web` provides. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is stated too broadly. Most ASP.NET Core integration test projects use |
||
|
|
||
| If your project uses an SDK other than `Microsoft.NET.Sdk`, keep that SDK, and configure MSTest manually. Add the `EnableMSTestRunner` property and set `OutputType` to `Exe` in your project file. Then add the MSTest references that your project requires. Ensure that you're using MSTest 3.2.0 or newer, and update to the latest MSTest version available. The following example uses `Microsoft.NET.Sdk`, but the same properties work with other project SDKs (for example, `Microsoft.NET.Sdk.Web`). | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two thoughts on this paragraph:
FYI I verified the combined-SDK path empirically: manually importing both |
||
|
|
||
| Consider the following example project file: | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.