未验证 提交 0d27b099 编写于 作者: V Viktor Hofer 提交者: GitHub

React to MSBuild Traversal and NoTargets SDK updates (#52895)

* Remove custom rebuild entry point in Build.proj

The rebuild target was added into the Traversal SDK here: https://github.com/microsoft/MSBuildSdks/commit/fd7660d62b139f282926d98212b7aeb3e6460daa#diff-ad560c0828c6bab536a01e43bb052bfce14a959b8df2c3f89cccfca0b399681c

* Update global.json

* Update global.json

* Update native-binplace.proj

* Update externals.csproj

* Update native-binplace.proj

* Update native-binplace.proj

* Default tfm for NoTargets projects

* Don't run GenFacades on ApiCompat.proj

* ApiCompat fix and packaging cleanup

* Fixes

* Only set if not multi-targeting
上级 9796ac9f
......@@ -7,9 +7,6 @@
<ProjectReference Include="$(RepoTasksDir)tasks.proj" Condition="'$(MSBuildRestoreSessionId)' != ''" />
</ItemGroup>
<!-- Custom arcade target which isn't available in Microsoft.Build.Traversal. -->
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Import Project="$(RepositoryEngineeringDir)SubsetValidation.targets" />
<!-- Upfront restore hooks -->
......@@ -21,4 +18,4 @@
<MSBuild Projects="$(RepoTasksDir)tasks.proj"
Targets="BuildIncrementally" />
</Target>
</Project>
\ No newline at end of file
</Project>
......@@ -278,6 +278,7 @@
</PropertyGroup>
<PropertyGroup>
<CustomBeforeNoTargets>$(RepositoryEngineeringDir)NoTargetsSdk.BeforeTargets.targets</CustomBeforeNoTargets>
<CustomAfterTraversalProps>$(RepositoryEngineeringDir)TraversalSdk.AfterProps.props</CustomAfterTraversalProps>
</PropertyGroup>
</Project>
<Project>
<PropertyGroup>
<!-- NoTargets SDK needs a TFM set. Use the latest .NETCoreApp TFM that is supported by the SDK.
Only set a default if the project isn't multi-targeting. -->
<TargetFramework Condition="'$(TargetFramework)' == '' and '$(TargetFrameworks)' == ''">$(NetCoreAppToolCurrent)</TargetFramework>
</PropertyGroup>
</Project>
\ No newline at end of file
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<!-- installer.tasks needs to be built in advance. -->
<UsingTask TaskName="RegenerateDownloadTable" AssemblyFile="$(InstallerTasksAssemblyPath)" />
......
......@@ -16,8 +16,8 @@
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.21264.2",
"Microsoft.DotNet.Helix.Sdk": "6.0.0-beta.21264.2",
"Microsoft.DotNet.SharedFramework.Sdk": "6.0.0-beta.21264.2",
"Microsoft.Build.NoTargets": "2.0.17",
"Microsoft.Build.Traversal": "2.1.1",
"Microsoft.Build.NoTargets": "3.0.4",
"Microsoft.Build.Traversal": "3.0.23",
"Microsoft.NET.Sdk.IL": "6.0.0-preview.5.21267.1"
}
}
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<!-- NoTargets SDK needs a TFM set. So we used the latest .NETCoreApp supported one. -->
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
</PropertyGroup>
<Target Name="PrepareForCrossgen">
<PropertyGroup>
......
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<!-- NoTargets SDK needs a TFM set. So we used the latest .NETCoreApp supported one. -->
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
</PropertyGroup>
<Target Name="BuildRuntime"
AfterTargets="Build">
......
......@@ -5,7 +5,6 @@
package's targets into the build.
-->
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncrementalNativeBuild Condition="'$(IncrementalNativeBuild)' == ''">true</IncrementalNativeBuild>
<BuildCoreHostDependsOn>GetProductVersions;GenerateNativeVersionFile</BuildCoreHostDependsOn>
<BuildCoreHostDependsOn Condition="'$(DisableSourceLink)' != 'true'">$(BuildCoreHostDependsOn);InitializeSourceControlInformationFromSourceControlManager</BuildCoreHostDependsOn>
......
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<!-- Set IsStableBuild to mimic https://github.com/dotnet/arcade/blob/694d59f090b743f894779d04a7ffe11cbaf352e7/src/Microsoft.DotNet.Arcade.Sdk/tools/Publish.proj#L30-L31 -->
<IsStableBuild>false</IsStableBuild>
<IsStableBuild Condition="'$(DotNetFinalVersionKind)' == 'release'">true</IsStableBuild>
......
......@@ -66,12 +66,16 @@
<BinPlaceRef Condition="'$(BinPlaceRef)' == '' and ('$(IsReferenceAssembly)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRef>
<BinPlaceRuntime Condition="'$(BinPlaceRuntime)' == '' and ('$(IsRuntimeAssembly)' == 'true' or '$(IsRuntimeAndReferenceAssembly)' == 'true')">true</BinPlaceRuntime>
<BinPlaceForTargetVertical Condition="'$(BinPlaceForTargetVertical)' == ''">true</BinPlaceForTargetVertical>
<GetBinPlaceItemsDependsOn Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">$(GetBinPlaceItemsDependsOn);AddDocumentationFileAsBinPlaceItemForExtensionsProjects</GetBinPlaceItemsDependsOn>
</PropertyGroup>
<ItemGroup Condition="$(MSBuildProjectName.StartsWith('Microsoft.Extensions.'))">
<!-- Microsoft.Extensions are not yet using the doc-file package -->
<BinPlaceItem Include="$(DocumentationFile)" />
</ItemGroup>
<Target Name="AddDocumentationFileAsBinPlaceItemForExtensionsProjects"
Condition="Exists('$(DocumentationFile)')">
<ItemGroup>
<!-- Microsoft.Extensions are not yet using the doc-file package -->
<BinPlaceItem Include="$(DocumentationFile)" />
</ItemGroup>
</Target>
<ItemGroup Condition="'@(BinPlaceTargetFrameworks)' == ''">
<!-- binplace to directories for the target vertical -->
......
<Project Sdk="Microsoft.Build.NoTargets">
<!-- These are wrapper project files for packaging.-->
<PropertyGroup>
<TargetFrameworks>netstandard1.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
\ No newline at end of file
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<!-- Avoid trying to binplace non existent documentation file.-->
<EnableBinPlacing>false</EnableBinPlacing>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- The project doesn't compile anything therefore create the package during build. -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsShipping>false</IsShipping>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<IsSourcePackage>true</IsSourcePackage>
......@@ -10,6 +10,6 @@
</PropertyGroup>
<ItemGroup>
<Content Include="*.cs" PackagePath="contentFiles/cs/netstandard1.0/%(FileName)%(Extension)" />
<Content Include="*.cs" PackagePath="contentFiles/cs/netstandard1.0/%(FileName)%(Extension)" BuildAction="Compile" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.SDK">
<!-- These are wrapper project files for packaging.-->
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppToolCurrent);net472</TargetFrameworks>
<PackageId>$(MSBuildProjectName)</PackageId>
<AvoidRestoreCycleOnSelfReference>true</AvoidRestoreCycleOnSelfReference>
<AssemblyName>Microsoft.NETCore.Platforms.BuildTasks</AssemblyName>
<!-- The only output of this project is the package as the tasks aren't packaged. -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsSourceProject>false</IsSourceProject>
<IsPackable>true</IsPackable>
......
<Project Sdk="Microsoft.Build.NoTargets">
<!-- These are wrapper project files for packaging.-->
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -8,7 +8,6 @@
<BinPlaceForTargetVertical>false</BinPlaceForTargetVertical>
<BinPlaceNative>true</BinPlaceNative>
<BinPlaceRuntime>false</BinPlaceRuntime>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
......
......@@ -13,8 +13,6 @@
<ItemGroup>
<ProjectReference Include="$(PkgDir)*\*.proj" Exclude="$(PkgDir)test\*" />
<ProjectReference Include="$(MSBuildThisFileDirectory)\Microsoft.NETCore.Platforms\src\Microsoft.NETCore.Platforms.csproj"
Condition="('$(BuildingAnOfficialBuildLeg)' != 'true' Or '$(BuildAllConfigurations)' == 'true') and '$(PgoInstrument)' != 'true'" />
<ProjectReference Include="$(MSBuildThisFileDirectory)*\src\*.*proj"
Condition="('$(BuildAllConfigurations)' == 'true' or '$(DotNetBuildFromSource)' == 'true')"
Exclude="$(MSBuildThisFileDirectory)*\src\**\*.shproj"/>
......
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<!-- Set to true to build this project -->
<BaselineApiCompat Condition="'$(BaselineApiCompat)' == ''">false</BaselineApiCompat>
<PreviousNetCoreApp>net5.0</PreviousNetCoreApp>
......@@ -20,17 +19,17 @@
<PackageDownload Include="$(PreviousNetCoreAppPackageId)" Version="[$(PreviousNetCoreAppPackageVersion)]" />
<PackageDownload Include="NETStandard.Library.Ref" Version="[$(NETStandardLibraryRefVersion)]" />
<PackageDownload Include="NETStandard.Library" Version="[$(NetStandardLibraryVersion)]" />
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="$(MicrosoftDotNetApiCompatVersion)" IsImplicitlyDefined="true" />
</ItemGroup>
<!-- Evaluate these properties inside a Target to gain access to TargetFrameworkIdentifier. -->
<!-- Evaluate these properties inside a Target to gain access to IntermediateOutputPath. -->
<Target Name="SetApiCompatFiles">
<PropertyGroup>
<ApiCompatResponseFile>$(IntermediateOutputPath)apicompat.rsp</ApiCompatResponseFile>
<ApiCompatTarget>$(TargetFrameworkIdentifier.Substring(1).ToLower())</ApiCompatTarget>
<ApiCompatBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.$(ApiCompatTarget).netfx461.txt</ApiCompatBaselineFile>
<ApiCompatBaselineIgnoreFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.$(ApiCompatTarget).netfx461.ignore.txt</ApiCompatBaselineIgnoreFile>
<ApiCompatNSBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.$(ApiCompatTarget).netstandard.txt</ApiCompatNSBaselineFile>
<ApiCompatNSOnlyBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.$(ApiCompatTarget).netstandardOnly.txt</ApiCompatNSOnlyBaselineFile>
<ApiCompatBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netfx461.txt</ApiCompatBaselineFile>
<ApiCompatBaselineIgnoreFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netfx461.ignore.txt</ApiCompatBaselineIgnoreFile>
<ApiCompatNSBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netstandard.txt</ApiCompatNSBaselineFile>
<ApiCompatNSOnlyBaselineFile>$(MSBuildThisFileDirectory)ApiCompatBaseline.netcoreapp.netstandardOnly.txt</ApiCompatNSOnlyBaselineFile>
</PropertyGroup>
</Target>
......@@ -53,37 +52,25 @@
<WriteLinesToFile File="$(ApiCompatResponseFile)" Lines="$(ApiCompatArgs)" Overwrite="true" />
<Exec Command="$(_ApiCompatCommand) &quot;@(NetFxReference -> '$(NetFxRefPath)%(Identity).dll')&quot; $(BaselineApiCompatArgs) @&quot;$(ApiCompatResponseFile)&quot; &gt; $(ApiCompatBaselineFile)"
Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)' and '$(BaselineApiCompat)' == 'true'"
Condition="'$(BaselineApiCompat)' == 'true'"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing $(NETFrameworkReferenceAssemblyTFM) to $(TargetFramework)" />
<Error Condition="'$(ApiCompatExitCode)' != '0'" Text="ApiCompat failed comparing $(NETFrameworkReferenceAssemblyTFM) to $(NetCoreAppCurrent)" />
<!--
In order to update the .NET Standard baseline, you can just start the build with either
/p:UpdateNETStandardBaseline=True
of
/p:UpdateNETStandardBaselineLocally=True
The difference is that the former uses the official .NET Standard while the latter uses a locally built
.NET Standard (Debug, in a folder parallel to where you checked out CoreFx).
In order to update the .NET Standard baseline, you can just start the build with /p:UpdateNETStandardBaseline=True
-->
<PropertyGroup>
<UpdateNETStandardBaseline Condition="'$(UpdateNETStandardBaseline)' == ''">False</UpdateNETStandardBaseline>
<UpdateNETStandardBaselineLocally Condition="'$(UpdateNETStandardBaselineLocally)' == ''">False</UpdateNETStandardBaselineLocally>
<_netStandardLibraryRefPath>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'netstandard.library.ref', '$(NETStandardLibraryRefVersion)', 'ref', 'netstandard2.1'))</_netStandardLibraryRefPath>
<_netStandardLibrary20RefPath>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'netstandard.library', '$(NetStandardLibraryVersion)', 'build', 'netstandard2.0', 'ref'))</_netStandardLibrary20RefPath>
<_netStandard21OnlyRef>$(_netStandardLibraryRefPath)netstandard.dll</_netStandard21OnlyRef>
<_netStandard21OnlyRef Condition="$(UpdateNETStandardBaselineLocally)">$(MSBuildThisFileDirectory)..\..\..\standard\artifacts\bin\ref\netstandard\Debug\netstandard.dll</_netStandard21OnlyRef>
<_netStandard21OnlyRef>$(NETStandard21RefPath)netstandard.dll</_netStandard21OnlyRef>
<_netStandard21BaselineModifer>--baseline</_netStandard21BaselineModifer>
<_netStandard21BaselineModifer Condition="$(UpdateNETStandardBaseline) or $(UpdateNETStandardBaselineLocally)">&gt;</_netStandard21BaselineModifer>
<_netStandard21BaselineModifer Condition="$(UpdateNETStandardBaseline)">&gt;</_netStandard21BaselineModifer>
</PropertyGroup>
<Exec Command="$(_ApiCompatCommand) &quot;$(_netStandard21OnlyRef)&quot; @&quot;$(ApiCompatResponseFile)&quot; $(_netStandard21BaselineModifer) &quot;$(ApiCompatNSOnlyBaselineFile)&quot;"
......
<Project>
<Import Project="..\Directory.Build.props" />
<Import Project="..\Directory.Build.props" />
<Import Project="netfxreference.props" />
<PropertyGroup>
<NETFrameworkReferenceAssemblyTFM>net48</NETFrameworkReferenceAssemblyTFM>
<NetFxRefPath>$(NuGetPackageRoot)microsoft.netframework.referenceassemblies.$(NETFrameworkReferenceAssemblyTFM)\$(MicrosoftNetFrameworkReferenceAssembliesVersion)\build\.NETFramework\v4.8\</NetFxRefPath>
<NETStandard21RefPath>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'netstandard.library.ref', '$(NETStandardLibraryRefVersion)', 'ref', 'netstandard2.1'))</NETStandard21RefPath>
</PropertyGroup>
<PropertyGroup Condition="'$(IsFrameworkSupportFacade)' == 'true'">
<IsNETCoreAppSrc>true</IsNETCoreAppSrc>
<IsNETCoreAppRef>true</IsNETCoreAppRef>
</PropertyGroup>
<PropertyGroup>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<GenFacadesIgnoreMissingTypes>true</GenFacadesIgnoreMissingTypes>
<!-- ensure the desktop compat shims reference the lowest possible version of dependencies
......@@ -17,9 +21,6 @@
netstandard.dll doesn't need to do this since it has no dangling dependencies -->
<GenFacadesForceZeroVersionSeeds Condition="'$(MSBuildProjectName)' != 'netstandard'">true</GenFacadesForceZeroVersionSeeds>
<HasMatchingContract>true</HasMatchingContract>
<NETFrameworkReferenceAssemblyTFM>net48</NETFrameworkReferenceAssemblyTFM>
<NetFxRefPath>$(NuGetPackageRoot)microsoft.netframework.referenceassemblies.$(NETFrameworkReferenceAssemblyTFM)\$(MicrosoftNetFrameworkReferenceAssembliesVersion)\build\.NETFramework\v4.8\</NetFxRefPath>
<NETStandard21RefPath>$(NuGetPackageRoot)netstandard.library.ref\$(NETStandardLibraryRefVersion)\ref\netstandard2.1\</NETStandard21RefPath>
</PropertyGroup>
<ItemGroup Condition="'$(MSBuildProjectName)' == 'System.Runtime' or
......@@ -31,9 +32,10 @@
<Compile Include="$(MSBuildThisFileDirectory)System.Void.cs" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(IsFrameworkSupportFacade)' == 'true'">
<!-- include any forwards needed by both generated and manual projects -->
<Compile Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildProjectName).forwards.cs')"
Include="$(MSBuildThisFileDirectory)$(MSBuildProjectName).forwards.cs" />
</ItemGroup>
</Project>
<Project>
<ItemGroup>
<ItemGroup Condition="'$(IsFrameworkSupportFacade)' == 'true'">
<ResolvedMatchingContract Include="$(ContractAssemblyPath)" />
</ItemGroup>
......
......@@ -2,6 +2,7 @@
<PropertyGroup>
<!-- Shims built from this directory will double as reference and runtime facades -->
<BinPlaceRef>true</BinPlaceRef>
<IsFrameworkSupportFacade>true</IsFrameworkSupportFacade>
<!-- if a manual project exists, it will be used for the runtime facade instead -->
<IsRuntimeAssembly Condition="!Exists('$(MSBuildThisFileDirectory)../manual/$(MSBuildProjectName).csproj')">true</IsRuntimeAssembly>
</PropertyGroup>
......
......@@ -2,6 +2,7 @@
<PropertyGroup>
<!-- ensure these projects use a different intermediate and output directory than generated projects -->
<OutDirName>manual.$(MSBuildProjectName)</OutDirName>
<IsFrameworkSupportFacade>true</IsFrameworkSupportFacade>
</PropertyGroup>
<Import Project="..\Directory.Build.props" />
......
......@@ -5,7 +5,6 @@
-->
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
<ProjTemplatePath>$(RepositoryEngineeringDir)slngen.template.proj</ProjTemplatePath>
<NuGetConfigTemplatePath>$(RepositoryEngineeringDir)slngen.nuget.config</NuGetConfigTemplatePath>
</PropertyGroup>
......
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<MonoLLVMHostOS Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">linux</MonoLLVMHostOS>
......
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<!-- OS name is case sensitive! -->
......
<Project Sdk="Microsoft.Build.NoTargets">
<UsingTask TaskName="Microsoft.WebAssembly.Build.Tasks.RunWithEmSdkEnv" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" />
<PropertyGroup>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
</PropertyGroup>
<UsingTask TaskName="Microsoft.WebAssembly.Build.Tasks.RunWithEmSdkEnv" AssemblyFile="$(WasmAppBuilderTasksAssemblyPath)" />
<PropertyGroup>
<!-- FIXME: clean up the duplication with libraries Directory.Build.props -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册