Skip to content

Commit fdb0372

Browse files
authored
Upgrade to more recent .NET SDK (#21017)
* Update SDK to preview.5.20251.2 - includes support for the `net5.0` TFM - includes fix for `$(PublishDepsFilePath)` - includes fix for incorrect NU5118 warnings when `'$(PackAsTool)' == 'true'` * !!temporary!! Suppress NU5129 warnings - build/ and buildTransitive/ naming conventions do not treat TFMs as equivalent * Run `InjectRequestHandlerOnPublish` later - late enough for .deps file to exist i.e. after the `CopyFilesToPublishDirectory` target - `AfterTargets` is a bit flaky; use `BeforeTargets` with empty targets instead * Always add `@(AssemblyAttribute)` items before they are processed - use `BeforeTargets="GetAssemblyAttributes"` for consistently throughout the repo
1 parent c9cdc48 commit fdb0372

File tree

8 files changed

+32
-17
lines changed

8 files changed

+32
-17
lines changed

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"sdk": {
3-
"version": "5.0.100-preview.2.20120.3"
3+
"version": "5.0.100-preview.5.20251.2"
44
},
55
"tools": {
6-
"dotnet": "5.0.100-preview.2.20120.3",
6+
"dotnet": "5.0.100-preview.5.20251.2",
77
"runtimes": {
88
"dotnet/x64": [
99
"$(MicrosoftNETCoreAppInternalPackageVersion)"

src/Mvc/Mvc.Razor.RuntimeCompilation/src/Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<Description>Runtime compilation support for Razor views and Razor Pages in ASP.NET Core MVC.</Description>
54
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
65
<NoWarn>$(NoWarn);CS1591</NoWarn>
6+
7+
<!-- !!! Temporary workaround while we switch TFMs. -->
8+
<NoWarn>$(NoWarn);NU5129</NoWarn>
9+
710
<GenerateDocumentationFile>true</GenerateDocumentationFile>
811
<PackageTags>aspnetcore;aspnetcoremvc;razor</PackageTags>
912
<IsPackable>true</IsPackable>

src/Mvc/Mvc.Testing/src/Microsoft.AspNetCore.Mvc.Testing.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
43
<Description>Support for writing functional tests for MVC applications.</Description>
54
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
65
<NoWarn>$(NoWarn);CS1591</NoWarn>
6+
7+
<!-- !!! Temporary workaround while we switch TFMs. -->
8+
<NoWarn>$(NoWarn);NU5129</NoWarn>
9+
710
<GenerateDocumentationFile>true</GenerateDocumentationFile>
811
<PackageTags>aspnetcore;aspnetcoremvc;aspnetcoremvctesting</PackageTags>
912
<IsPackable>true</IsPackable>
@@ -21,5 +24,4 @@
2124
<ItemGroup>
2225
<Content Include="Microsoft.AspNetCore.Mvc.Testing.targets" Pack="true" PackagePath="build/$(TargetFramework)/" />
2326
</ItemGroup>
24-
2527
</Project>

src/Mvc/Mvc.Testing/src/Microsoft.AspNetCore.Mvc.Testing.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424
</Target>
2525

26-
<Target Name="_AddContentRootForProjectReferences" BeforeTargets="BeforeCompile" DependsOnTargets="_ResolveMvcTestProjectReferences">
26+
<Target Name="_AddContentRootForProjectReferences" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="_ResolveMvcTestProjectReferences">
2727
<ItemGroup>
2828
<WebApplicationFactoryContentRootAttribute
2929
Condition="'%(_ContentRootProjectReferences.Identity)' != ''"
@@ -35,7 +35,7 @@
3535
</ItemGroup>
3636

3737
<ItemGroup>
38-
<AssemblyAttribute
38+
<AssemblyAttribute
3939
Condition=" '%(WebApplicationFactoryContentRootAttribute.Identity)' != '' "
4040
Include="Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryContentRootAttribute">
4141
<_Parameter1>%(WebApplicationFactoryContentRootAttribute.AssemblyName)</_Parameter1>
@@ -55,5 +55,5 @@
5555

5656
<Copy SourceFiles="%(DepsFilePaths.FullPath)" DestinationFolder="$(OutDir)" Condition="Exists('%(DepsFilePaths.FullPath)')" />
5757
</Target>
58-
58+
5959
</Project>

src/ProjectTemplates/BlazorTemplates.Tests/BlazorTemplates.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</AssemblyAttribute>
7171
</ItemGroup>
7272

73-
<Target Name="PrepareForTest" BeforeTargets="CoreCompile" Condition="$(DesignTimeBuild) != true">
73+
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">
7474
<PropertyGroup>
7575
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>
7676
<TestTemplateTestsProps>$(TestTemplateCreationFolder)$(TestTemplateTestsProps)</TestTemplateTestsProps>

src/ProjectTemplates/test/ProjectTemplates.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
</AssemblyAttribute>
7474
</ItemGroup>
7575

76-
<Target Name="PrepareForTest" BeforeTargets="CoreCompile" Condition="$(DesignTimeBuild) != true">
76+
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">
7777
<PropertyGroup>
7878
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>
7979
<TestTemplateTestsProps>$(TestTemplateCreationFolder)$(TestTemplateTestsProps)</TestTemplateTestsProps>

src/Servers/IIS/build/testsite.props

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,27 @@
5959
</PropertyGroup>
6060
</Target>
6161

62+
<!--
63+
GenerateBuildDependencyFile creates the .deps file used here. BuildDepsJson and CoreBuild are empty targets marking
64+
the end of processes using the GenerateBuildDependencyFile target.
65+
-->
6266
<Target Name="InjectRequestHandler"
6367
Condition=" '$(InProcessTestSite)' == 'true' AND '$(BuildIisNativeProjects)' == 'true' AND '$(TargetFrameworkIdentifier)' != '.NETFramework'"
64-
AfterTargets="GenerateBuildDependencyFile"
65-
DependsOnTargets="PrepareInjectionApp">
68+
BeforeTargets="BuildDepsJson;CoreBuild"
69+
DependsOnTargets="GenerateBuildDependencyFile;PrepareInjectionApp">
6670
<Exec Command="$(InjectDepsApp) &quot;$(ProjectDepsFilePath)&quot; $(RuntimeIdentifier) " />
6771
</Target>
6872

73+
<!--
74+
GeneratePublishDependencyFile creates an intermediate .deps file copied soon after into the publish folder.
75+
CopyFilesToPublishDirectory is an empty target marking the end of all copies into the publish folder, including the
76+
.deps file and native assets. Publish is an empty target marking the end of the entire process.
77+
(GenerateSingleFileBundle also uses the intermediate .desp file but only in single-file publish cases ignored here.)
78+
-->
6979
<Target Name="InjectRequestHandlerOnPublish"
7080
Condition=" '$(InProcessTestSite)' == 'true' AND '$(BuildIisNativeProjects)' == 'true' AND '$(TargetFrameworkIdentifier)' != '.NETFramework'"
71-
AfterTargets="GeneratePublishDependencyFile"
72-
DependsOnTargets="PrepareInjectionApp">
81+
BeforeTargets="Publish"
82+
DependsOnTargets="GeneratePublishDependencyFile;CopyFilesToPublishDirectory;PrepareInjectionApp">
7383
<Exec Command="$(InjectDepsApp) &quot;$(PublishDepsFilePath)&quot; $(RuntimeIdentifier) " />
7484
</Target>
7585

src/Shared/E2ETesting/E2ETesting.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
</ItemGroup>
7878
</Target>
7979

80-
<Target Name="_AddTestProjectMetadataAttributes" BeforeTargets="BeforeCompile" DependsOnTargets="_ResolveTestProjectReferences">
80+
<Target Name="_AddTestProjectMetadataAttributes" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="_ResolveTestProjectReferences">
8181
<ItemGroup>
8282
<_ContentRootMetadata
8383
Condition="'%(_ContentRootProjectReferences.Identity)' != ''"
@@ -98,7 +98,7 @@
9898
</ItemGroup>
9999
</Target>
100100

101-
<Target Name="_AddSeleniumSupportedMetadataAttribute" BeforeTargets="BeforeCompile">
101+
<Target Name="_AddSeleniumSupportedMetadataAttribute" BeforeTargets="GetAssemblyAttributes">
102102
<PropertyGroup>
103103
<_SeleniumE2ETestsSupportedAttributeValue>false</_SeleniumE2ETestsSupportedAttributeValue>
104104
<_SeleniumE2ETestsSupportedAttributeValue Condition="'$(SeleniumE2ETestsSupported)' == 'true'">true</_SeleniumE2ETestsSupportedAttributeValue>
@@ -118,7 +118,7 @@
118118
</ItemGroup>
119119
</Target>
120120

121-
<Target Name="_AddProcessTrackingMetadataAttribute" BeforeTargets="BeforeCompile">
121+
<Target Name="_AddProcessTrackingMetadataAttribute" BeforeTargets="GetAssemblyAttributes">
122122
<MakeDir Directories="$(SeleniumProcessTrackingFolder)" />
123123
<ItemGroup>
124124
<AssemblyAttribute

0 commit comments

Comments
 (0)