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
This commit is contained in:
Doug Bunting 2020-05-05 21:59:15 -07:00 committed by GitHub
parent c9cdc4891a
commit fdb0372a67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 17 deletions

View File

@ -1,9 +1,9 @@
{
"sdk": {
"version": "5.0.100-preview.2.20120.3"
"version": "5.0.100-preview.5.20251.2"
},
"tools": {
"dotnet": "5.0.100-preview.2.20120.3",
"dotnet": "5.0.100-preview.5.20251.2",
"runtimes": {
"dotnet/x64": [
"$(MicrosoftNETCoreAppInternalPackageVersion)"

View File

@ -1,9 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Runtime compilation support for Razor views and Razor Pages in ASP.NET Core MVC.</Description>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<!-- !!! Temporary workaround while we switch TFMs. -->
<NoWarn>$(NoWarn);NU5129</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;aspnetcoremvc;razor</PackageTags>
<IsPackable>true</IsPackable>

View File

@ -1,9 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>Support for writing functional tests for MVC applications.</Description>
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<!-- !!! Temporary workaround while we switch TFMs. -->
<NoWarn>$(NoWarn);NU5129</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;aspnetcoremvc;aspnetcoremvctesting</PackageTags>
<IsPackable>true</IsPackable>
@ -21,5 +24,4 @@
<ItemGroup>
<Content Include="Microsoft.AspNetCore.Mvc.Testing.targets" Pack="true" PackagePath="build/$(TargetFramework)/" />
</ItemGroup>
</Project>

View File

@ -23,7 +23,7 @@
</ItemGroup>
</Target>
<Target Name="_AddContentRootForProjectReferences" BeforeTargets="BeforeCompile" DependsOnTargets="_ResolveMvcTestProjectReferences">
<Target Name="_AddContentRootForProjectReferences" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="_ResolveMvcTestProjectReferences">
<ItemGroup>
<WebApplicationFactoryContentRootAttribute
Condition="'%(_ContentRootProjectReferences.Identity)' != ''"
@ -35,7 +35,7 @@
</ItemGroup>
<ItemGroup>
<AssemblyAttribute
<AssemblyAttribute
Condition=" '%(WebApplicationFactoryContentRootAttribute.Identity)' != '' "
Include="Microsoft.AspNetCore.Mvc.Testing.WebApplicationFactoryContentRootAttribute">
<_Parameter1>%(WebApplicationFactoryContentRootAttribute.AssemblyName)</_Parameter1>
@ -55,5 +55,5 @@
<Copy SourceFiles="%(DepsFilePaths.FullPath)" DestinationFolder="$(OutDir)" Condition="Exists('%(DepsFilePaths.FullPath)')" />
</Target>
</Project>

View File

@ -70,7 +70,7 @@
</AssemblyAttribute>
</ItemGroup>
<Target Name="PrepareForTest" BeforeTargets="CoreCompile" Condition="$(DesignTimeBuild) != true">
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">
<PropertyGroup>
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>
<TestTemplateTestsProps>$(TestTemplateCreationFolder)$(TestTemplateTestsProps)</TestTemplateTestsProps>

View File

@ -73,7 +73,7 @@
</AssemblyAttribute>
</ItemGroup>
<Target Name="PrepareForTest" BeforeTargets="CoreCompile" Condition="$(DesignTimeBuild) != true">
<Target Name="PrepareForTest" BeforeTargets="GetAssemblyAttributes" Condition="$(DesignTimeBuild) != true">
<PropertyGroup>
<TestTemplateCreationFolder>$([MSBuild]::NormalizePath('$(OutputPath)$(TestTemplateCreationFolder)'))</TestTemplateCreationFolder>
<TestTemplateTestsProps>$(TestTemplateCreationFolder)$(TestTemplateTestsProps)</TestTemplateTestsProps>

View File

@ -59,17 +59,27 @@
</PropertyGroup>
</Target>
<!--
GenerateBuildDependencyFile creates the .deps file used here. BuildDepsJson and CoreBuild are empty targets marking
the end of processes using the GenerateBuildDependencyFile target.
-->
<Target Name="InjectRequestHandler"
Condition=" '$(InProcessTestSite)' == 'true' AND '$(BuildIisNativeProjects)' == 'true' AND '$(TargetFrameworkIdentifier)' != '.NETFramework'"
AfterTargets="GenerateBuildDependencyFile"
DependsOnTargets="PrepareInjectionApp">
BeforeTargets="BuildDepsJson;CoreBuild"
DependsOnTargets="GenerateBuildDependencyFile;PrepareInjectionApp">
<Exec Command="$(InjectDepsApp) &quot;$(ProjectDepsFilePath)&quot; $(RuntimeIdentifier) " />
</Target>
<!--
GeneratePublishDependencyFile creates an intermediate .deps file copied soon after into the publish folder.
CopyFilesToPublishDirectory is an empty target marking the end of all copies into the publish folder, including the
.deps file and native assets. Publish is an empty target marking the end of the entire process.
(GenerateSingleFileBundle also uses the intermediate .desp file but only in single-file publish cases ignored here.)
-->
<Target Name="InjectRequestHandlerOnPublish"
Condition=" '$(InProcessTestSite)' == 'true' AND '$(BuildIisNativeProjects)' == 'true' AND '$(TargetFrameworkIdentifier)' != '.NETFramework'"
AfterTargets="GeneratePublishDependencyFile"
DependsOnTargets="PrepareInjectionApp">
BeforeTargets="Publish"
DependsOnTargets="GeneratePublishDependencyFile;CopyFilesToPublishDirectory;PrepareInjectionApp">
<Exec Command="$(InjectDepsApp) &quot;$(PublishDepsFilePath)&quot; $(RuntimeIdentifier) " />
</Target>

View File

@ -77,7 +77,7 @@
</ItemGroup>
</Target>
<Target Name="_AddTestProjectMetadataAttributes" BeforeTargets="BeforeCompile" DependsOnTargets="_ResolveTestProjectReferences">
<Target Name="_AddTestProjectMetadataAttributes" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="_ResolveTestProjectReferences">
<ItemGroup>
<_ContentRootMetadata
Condition="'%(_ContentRootProjectReferences.Identity)' != ''"
@ -98,7 +98,7 @@
</ItemGroup>
</Target>
<Target Name="_AddSeleniumSupportedMetadataAttribute" BeforeTargets="BeforeCompile">
<Target Name="_AddSeleniumSupportedMetadataAttribute" BeforeTargets="GetAssemblyAttributes">
<PropertyGroup>
<_SeleniumE2ETestsSupportedAttributeValue>false</_SeleniumE2ETestsSupportedAttributeValue>
<_SeleniumE2ETestsSupportedAttributeValue Condition="'$(SeleniumE2ETestsSupported)' == 'true'">true</_SeleniumE2ETestsSupportedAttributeValue>
@ -118,7 +118,7 @@
</ItemGroup>
</Target>
<Target Name="_AddProcessTrackingMetadataAttribute" BeforeTargets="BeforeCompile">
<Target Name="_AddProcessTrackingMetadataAttribute" BeforeTargets="GetAssemblyAttributes">
<MakeDir Directories="$(SeleniumProcessTrackingFolder)" />
<ItemGroup>
<AssemblyAttribute