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
Ability to reference SDK without the version #2703
Comments
Hi @martincostello, the MSBuild sdk versioning doesn't allow the usage of the As you can see here https://github.com/microsoft/testfx/tree/main/src/Package/MSTest.Sdk/Sdk an MSBuild SDK is a bunch of props/targets that we compose (for instance this is the main file https://github.com/microsoft/testfx/blob/main/src/Package/MSTest.Sdk/Sdk/Runner/ClassicEngine.targets). So it's not easy have 1 version for everything because the imports will import more packages with different versions. So our 3.1.1 sdk actually is the "version" of MSTest from feature perspective but it's composed by more packages from different part of the platform and with different versions. For instance the new testing platform(https://github.com/microsoft/testfx/blob/main/docs/testingplatform/Index.md) that empower the runner is at the moment at version 1.1.0. The only way at the moment to centralize the version at solution level is to use the When the version is missing the resolver goes to the default installed MSBuild sdks (i.e. C:\Program Files\dotnet\sdk\8.0.104\Sdks) or to NuGet(available feeds) using the version specified inside the |
Thanks for the information - I'll have a look to see if adding the SDK in |
Use MSBuild SDK in `global.json` for the version of `MSTest.Sdk` so that dependabot can update it at the same time as `MSTest.TestFramework`. See microsoft/testfx#2703 (comment).
That did the trick - maybe worth calling out in some documentation somewhere? I originally just copy-pasted from the samples in the blog post. |
Use MSBuild SDK in `global.json` for the version of `MSTest.Sdk` so that dependabot can update it at the same time as `MSTest.TestFramework`. See microsoft/testfx#2703 (comment).
Good idea, it's in the note box under the code sample https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-mstest-sdk but looks like is not super clear, thanks for the suggestion. |
TODOs:
|
@martincostello I will move on this ticket as completed as the docs and samples have been added/edited. |
Summary
I don't know if this a general MSBuild restriction, or specific to the new SDK, so this might not be the right place to feedback on this.
Add the ability to reference the SDK without the version number, for example:
Background and Motivation
Requiring the
Sdk
to include the version is not friendly to package updating tools or NuGet Central Package Version Management where the aim is to define the package version(s) in exactly one place and to then allow them to be easily maintained in an automated version with tools such as dependabot or dotnet-outdated.I experimented with using an MSBuild property for the version, but MSBuild does not appear to use the value late enough in project loading to be able to use that approach.
Proposed Feature
Somehow allow the SDK to be loaded/referenced without an explicit version number by loading it from the package reference (e.g. from
<PackageVersion Include="MSTest.TestFramework" Version="3.3.1" />
).Alternative Designs
None.
The text was updated successfully, but these errors were encountered: