Skip to content

Commit 3c1fe99

Browse files
authored
Error on unsupported tfms (#15072) (#15073)
* Warning on unsupported tfms (#15072) * Add warning when restoring old TFM * revert * Revert "revert" This reverts commit 81c7638. * Make the warning error, and restore previous props so we attempt to run (#15078) * Make the warning error, and restore previous props so we get errors when user suppresses * Update src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.nuspec * Correct file count, because we are adding more props * Wrong edit
1 parent 253e294 commit 3c1fe99

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

eng/verify-nupkgs.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function Verify-Nuget-Packages {
1818
Write-Host "Starting Verify-Nuget-Packages."
1919
$expectedNumOfFiles = @{
2020
"Microsoft.CodeCoverage" = 59;
21-
"Microsoft.NET.Test.Sdk" = 15;
21+
"Microsoft.NET.Test.Sdk" = 25;
2222
"Microsoft.TestPlatform" = 619;
2323
"Microsoft.TestPlatform.Build" = 20;
2424
"Microsoft.TestPlatform.CLI" = 481;

src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<None Update="Microsoft.NET.Test.Sdk.props">
3030
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3131
</None>
32+
<None Update="Microsoft.NET.Test.Sdk.targets">
33+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
34+
</None>
3235
<None Update="netcoreapp\*">
3336
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3437
</None>

src/package/Microsoft.NET.Test.Sdk/Microsoft.NET.Test.Sdk.nuspec

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88
<dependency id="Microsoft.TestPlatform.TestHost" version="$Version$" />
99
<dependency id="Microsoft.CodeCoverage" version="$Version$" />
1010
</group>
11+
1112
<group targetFramework="net462">
1213
<!-- TestHost gets shipped with vstest.console -->
1314
<dependency id="Microsoft.CodeCoverage" version="$Version$" />
1415
</group>
16+
17+
<group targetFramework="native0.0">
18+
</group>
19+
1520
</dependencies>
1621
</metadata>
1722

@@ -21,11 +26,27 @@
2126
<file src="netstandard2.0\netcoreapp\*" target="build\net8.0\" />
2227
<file src="netstandard2.0\netfx\*" target="build\net462\" />
2328

24-
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="buildMultiTargeting\" />
29+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="buildMultiTargeting\net462\" />
30+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="buildMultiTargeting\net8.0\" />
2531
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="build\net8.0\" />
2632
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="build\net462\" />
2733

34+
<!-- Add incompatibility error, and add the props, in case user decides to ignore it. -->
35+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="buildMultiTargeting\netcoreapp2.0\" />
36+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.targets" target="buildMultiTargeting\netcoreapp2.0\" />
37+
38+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="build\netcoreapp2.0\" />
39+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.targets" target="build\netcoreapp2.0\" />
40+
41+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="buildMultiTargeting\netstandard2.0\" />
42+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.targets" target="buildMultiTargeting\netstandard2.0\" />
43+
44+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.props" target="build\netstandard2.0\" />
45+
<file src="netstandard2.0\Microsoft.NET.Test.Sdk.targets" target="build\netstandard2.0\" />
46+
2847
<file src="netstandard2.0\_._" target="lib/net8.0" />
2948
<file src="netstandard2.0\_._" target="lib/net462" />
49+
50+
<file src="netstandard2.0\_._" target="lib/native" />
3051
</files>
3152
</package>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project InitialTargets="NonCompatibleTargetFrameworkError_Microsoft_NET_Test_Sdk_net8_0">
2+
<Target Name="NonCompatibleTargetFrameworkError_Microsoft_NET_Test_Sdk_net8_0"
3+
Condition="'$(SuppressTfmSupportBuildErrors)' == ''">
4+
<Error Text="Microsoft.NET.Test.Sdk doesn't support $(TargetFramework) and has not been tested with it. Consider upgrading your TargetFramework to net8.0 or later. You may also set &lt;SuppressTfmSupportBuildErrors&gt;true&lt;/SuppressTfmSupportBuildErrors&gt; in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk." />
5+
</Target>
6+
</Project>

0 commit comments

Comments
 (0)