MSTest.Sdk: do not use IsImplictlyDefined #2880
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Do not use the
IsImplictlyDefined="true"
attribute in thePackageReference
element in the.targets
files. Instead,rely on the
VersionOverride
attribute to define the package version. This is because for big projects, teams are usuallyslowly migrating to MSTest.Sdk so they need to keep defining MSTest (and platform) packages in their CPM file.
If we use 'IsImplicitlyDefined' attribute, the package will be "defined twice" which will lead to
NU1009
warnings thatare most of the time updated as errors (warnAsError). We created a thread with MSBuild and NuGet teams and the only suggested
solution is for users to suppress the warning which is not ideal. Until a better solution is provided, we will use the
VersionOverride
trick instead as it achieves a relatively close behavior while preventing the warning.We could also consider having a property like
MSTestSdkDisableIsImplicitlyDefinedAttribute
that users can set totrue
todisable the
IsImplicitlyDefined
attribute in the.targets
files but we don't see any strong reason to do that at the moment.