Stop reading TargetFramework prop in props files (#52897)

* Stop reading TargetFramework prop in props files

The TargetFramework property isn't expected to be set in props files
before a project's body is evaluated.

Don't let BuildTargetFramework property fallback to TargetFramework as
BTF's sole intent is to convey the TargetFramework to filter to and not
the current selected TargetFramework. Reduce usage of BTF so that it is
only used in places where code is actually conditioned on filtering.

In addition to that, specify BuildTargetFramework as a global property for
all traversal builds so when invoking one of the traversal projects directly
(src.proj, ref.proj, etc.), BuildTargetFramework doesn't need to specified
manually to get the default behavior (filter on compatible to net6.0).
Remove the inferred BuildingNetCoreAppVertical because of that and
inline its meaning.

Make sendtohelix a normal NoTargets proj so that it has access to the
properties which were moved into the Directory.Build.targets file as
otherwise it wouldn't import that file.
This commit is contained in:
Viktor Hofer 2021-05-19 20:04:01 +02:00 committed by GitHub
parent 220fee407b
commit 68c5658b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 99 additions and 121 deletions

View File

@ -1,9 +1,5 @@
<Project Sdk="Microsoft.Build.Traversal">
<PropertyGroup>
<TraversalGlobalProperties Condition="'$(BuildAllConfigurations)' != 'true'">BuildTargetFramework=$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(NetCoreAppCurrent)'))</TraversalGlobalProperties>
</PropertyGroup>
<ItemGroup>
<!-- Subsets are already imported by Directory.Build.props. -->
<ProjectReference Include="@(ProjectToBuild)" />

View File

@ -258,7 +258,6 @@
'$(MSBuildProjectExtension)' != '.sfxproj')">false</GeneratePackage>
</PropertyGroup>
<!-- Language configuration -->
<PropertyGroup>
<!-- default to allowing all language features -->
@ -277,4 +276,8 @@
<!-- By default the SDK produces ref assembly for 5.0 or later -->
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
<PropertyGroup>
<CustomAfterTraversalProps>$(RepositoryEngineeringDir)TraversalSdk.AfterProps.props</CustomAfterTraversalProps>
</PropertyGroup>
</Project>

View File

@ -49,8 +49,11 @@
<DefaultMonoSubsets Condition="'$(TargetOS)' == 'Browser'">$(DefaultMonoSubsets)mono.wasmruntime+</DefaultMonoSubsets>
<DefaultMonoSubsets Condition="'$(MonoCrossAOTTargetOS)' != ''">$(DefaultMonoSubsets)mono.aotcross+</DefaultMonoSubsets>
<DefaultMonoSubsets>$(DefaultMonoSubsets)mono.runtime+mono.corelib+mono.packages</DefaultMonoSubsets>
<DefaultLibrariesSubsets>libs.native+libs.ref+libs.src+libs.pretest+libs.packages</DefaultLibrariesSubsets>
<DefaultLibrariesSubsets Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or
'$(BuildTargetFramework)' == '' or
'$(BuildAllConfigurations)' == 'true'">libs.native+</DefaultLibrariesSubsets>
<DefaultLibrariesSubsets>$(DefaultLibrariesSubsets)libs.ref+libs.src+libs.pretest+libs.packages</DefaultLibrariesSubsets>
<DefaultHostSubsets>host.native+host.pkg+host.tools+host.tests</DefaultHostSubsets>
<DefaultHostSubsets Condition="'$(RuntimeFlavor)' == 'Mono'"></DefaultHostSubsets>

View File

@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<!-- Build for NetCoreAppCurrent by default if no BuildTargetFramework is supplied or if not all configurations are built. -->
<TraversalGlobalProperties Condition="'$(BuildAllConfigurations)' != 'true'">BuildTargetFramework=$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(NetCoreAppCurrent)'))</TraversalGlobalProperties>
</PropertyGroup>
</Project>

View File

@ -47,7 +47,8 @@
</ItemGroup>
<PropertyGroup>
<ILLinkTrimAssemblyArtifactsRootDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ILLinkTrimAssembly', '$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)'))</ILLinkTrimAssemblyArtifactsRootDir>
<NetCoreAppCurrentBuildSettings Condition="'$(NetCoreAppCurrentBuildSettings)' == ''">$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</NetCoreAppCurrentBuildSettings>
<ILLinkTrimAssemblyArtifactsRootDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'ILLinkTrimAssembly', '$(NetCoreAppCurrentBuildSettings)'))</ILLinkTrimAssemblyArtifactsRootDir>
<ILLinkTrimAssemblyRuntimePackSuppressionsXmlsDir>$(ILLinkTrimAssemblyArtifactsRootDir)suppressions-xmls\</ILLinkTrimAssemblyRuntimePackSuppressionsXmlsDir>
<ILLinkTrimAssemblyOOBSuppressionsXmlsDir>$(ILLinkTrimAssemblyArtifactsRootDir)oob-suppressions-xmls\</ILLinkTrimAssemblyOOBSuppressionsXmlsDir>
<ILLinkTrimAssemblySuppressionsXmlsDir Condition="'$(IsNETCoreAppSrc)' == 'true'">$(ILLinkTrimAssemblyRuntimePackSuppressionsXmlsDir)</ILLinkTrimAssemblySuppressionsXmlsDir>
@ -58,15 +59,15 @@
Must be enabled by setting BinPlaceILLinkTrimAssembly=true
-->
<ItemGroup Condition="'$(BinPlaceILLinkTrimAssembly)' == 'true'">
<BinPlaceTargetFramework Include="$(BuildSettings)">
<BinPlaceTargetFramework Include="$(NetCoreAppCurrentBuildSettings)">
<RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)trimmed</RuntimePath>
<ItemName>TrimmedItem</ItemName>
</BinPlaceTargetFramework>
<BinPlaceTargetFramework Include="$(BuildSettings)">
<BinPlaceTargetFramework Include="$(NetCoreAppCurrentBuildSettings)">
<RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)reports</RuntimePath>
<ItemName>TrimmingReport</ItemName>
</BinPlaceTargetFramework>
<BinPlaceTargetFramework Include="$(BuildSettings)">
<BinPlaceTargetFramework Include="$(NetCoreAppCurrentBuildSettings)">
<RuntimePath>$(ILLinkTrimAssemblyArtifactsRootDir)pretrimmed</RuntimePath>
<ItemName>PreTrimmedItem</ItemName>
</BinPlaceTargetFramework>

View File

@ -15,7 +15,7 @@ parameters:
scenarios: ''
steps:
- script: $(_msbuildCommand)
- script: $(_msbuildCommand) -restore
$(Build.SourcesDirectory)/src/libraries/sendtohelix.proj
/p:RuntimeFlavor=${{ parameters.runtimeFlavor }}
/p:TargetArchitecture=${{ parameters.archType }}

View File

@ -29,7 +29,7 @@
</PropertyGroup>
<PropertyGroup Condition="'@(CoverageIncludeDirectory)' != ''">
<CoverageIncludeDirectoryFilter>@(CoverageIncludeDirectory -> '$(TestHostRootPath)%(Identity)', ',')</CoverageIncludeDirectoryFilter>
<CoverageIncludeDirectoryFilter>@(CoverageIncludeDirectory -> '$(NetCoreAppCurrentTestHostPath)%(Identity)', ',')</CoverageIncludeDirectoryFilter>
</PropertyGroup>
</Target>

View File

@ -38,7 +38,7 @@
.Replace('$$DISABLEPARALLELIZATION$$', '$([MSBuild]::ValueOrDefault('$(TestDisableParallelization)', 'false'))')
.Replace('$$DISABLEAPPDOMAIN$$', '$([MSBuild]::ValueOrDefault('$(TestDisableAppDomain)', 'false'))')
.Replace('$$TESTCASEFILTER$$', '$(_testFilter)')
.Replace('$$DOTNETHOSTPATH$$', '$(TestHostRootPath)$([System.IO.Path]::GetFileName('$(DotNetTool)'))'))</RunSettingsFileContent>
.Replace('$$DOTNETHOSTPATH$$', '$(NetCoreAppCurrentTestHostPath)$([System.IO.Path]::GetFileName('$(DotNetTool)'))'))</RunSettingsFileContent>
</PropertyGroup>
<WriteLinesToFile File="$(RunSettingsOutputFilePath)"

View File

@ -102,7 +102,7 @@
<RunTestsCommand>"$(RunScriptOutputPath)"</RunTestsCommand>
<!-- Use runtime path only for the live built shared framework (NetCoreAppCurrent). -->
<RunTestsCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)'))">$(RunTestsCommand) --runtime-path "$(TestHostRootPath.TrimEnd('\/'))"</RunTestsCommand>
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '$(NETCoreAppCurrentVersion)'))">$(RunTestsCommand) --runtime-path "$(NetCoreAppCurrentTestHostPath.TrimEnd('\/'))"</RunTestsCommand>
<RunTestsCommand Condition="'$(TestRspFile)' != '' and '$(RuntimeFlavor)' != 'Mono'">$(RunTestsCommand) --rsp-file "$(TestRspFile)"</RunTestsCommand>
<RunTestsCommand Condition="'$(TargetsMobile)' == 'true'">"$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture) $(TargetOS.ToLowerInvariant()) $(TestProjectName) $(AdditionalXHarnessArguments)</RunTestsCommand>
<RunTestsCommand Condition="'$(TargetOS)' == 'Browser'">"$(RunScriptOutputPath)" $(JSEngine) $(AssemblyName).dll $(Scenario)</RunTestsCommand>

View File

@ -1,8 +1,4 @@
<Project Sdk="Microsoft.Build.Traversal" DefaultTargets="Pack">
<PropertyGroup>
<TraversalGlobalProperties>BuildAllProjects=true</TraversalGlobalProperties>
</PropertyGroup>
<ItemGroup Condition="'$(TargetOS)' == 'windows' or '$(DotNetBuildFromSource)' == 'true'">
<ProjectReference Include="Microsoft.NET.Sdk.IL\Microsoft.NET.Sdk.IL.pkgproj" />
<ProjectReference Include="Microsoft.ILVerification\Microsoft.ILVerification.pkgproj" />

View File

@ -1,8 +1,4 @@
<Project Sdk="Microsoft.Build.Traversal" DefaultTargets="Pack">
<PropertyGroup>
<TraversalGlobalProperties>BuildAllProjects=true</TraversalGlobalProperties>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="Microsoft.NETCore.DotNetAppHost\Microsoft.NETCore.DotNetAppHost.pkgproj" />
<ProjectReference Include="Microsoft.NETCore.DotNetHost\Microsoft.NETCore.DotNetHost.pkgproj" />

View File

@ -26,13 +26,9 @@
<Import Sdk="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Project="Sdk.props" Condition="'$(UseTargetFrameworkSDK)' != 'false'" />
<PropertyGroup>
<BuildTargetFramework Condition="'$(BuildTargetFramework)' == '' and '$(TargetFramework)' != ''">$([System.Text.RegularExpressions.Regex]::Replace('$(TargetFramework)', '(-[^;]+)', ''))</BuildTargetFramework>
<!-- Build all .NET Framework configurations when net48 is passed in. This is for convenience. -->
<AdditionalBuildTargetFrameworks Condition="'$(BuildTargetFramework)' == 'net48'">net45;net451;net452;net46;net461;net462;net47;net471;net472</AdditionalBuildTargetFrameworks>
<AdditionalBuildTargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true' and '$(BuildAllProjects)' == 'true'">$(AdditionalBuildTargetFrameworks);netstandard2.0</AdditionalBuildTargetFrameworks>
<!-- Initialize BuildSettings from the individual properties. -->
<BuildSettings>$(BuildTargetFramework)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</BuildSettings>
<BuildSettings Condition="'$(BuildTargetFramework)' == ''">$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</BuildSettings>
</PropertyGroup>
<!-- Define test projects and companions -->
@ -59,10 +55,6 @@
<!-- Common repo directories -->
<PropertyGroup>
<!-- Need to try and keep the same logic as the native builds as we need this for packaging -->
<_targetFrameworkValue>$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(TargetFramework)'))</_targetFrameworkValue>
<_targetFrameworkValue>$([MSBuild]::ValueOrDefault('$(_targetFrameworkValue)', '$(NetCoreAppCurrent)'))</_targetFrameworkValue>
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(_targetFrameworkValue)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)'))</NativeBinDir>
<PkgDir>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'pkg'))</PkgDir>
</PropertyGroup>
@ -78,12 +70,6 @@
<ProjectExclusions Include="$(CommonTestPath)System\Net\Prerequisites\**\*.csproj" />
</ItemGroup>
<PropertyGroup>
<BuildingNETCoreAppVertical Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or
'$(BuildAllConfigurations)' == 'true'">true</BuildingNETCoreAppVertical>
<BinPlaceTestSharedFramework Condition="'$(BuildingNETCoreAppVertical)' == 'true'">true</BinPlaceTestSharedFramework>
</PropertyGroup>
<!-- Import packaging props -->
<Import Project="$(RepositoryEngineeringDir)packaging.props" />
@ -148,9 +134,6 @@
<ASPNETCoreAppPackageRefPath>$(ArtifactsBinDir)pkg\aspnetcoreapp\ref</ASPNETCoreAppPackageRefPath>
<ASPNETCoreAppPackageRuntimePath>$(ArtifactsBinDir)pkg\aspnetcoreapp\lib</ASPNETCoreAppPackageRuntimePath>
<TestHostRootPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testhost', '$(BuildSettings)'))</TestHostRootPath>
<NETCoreAppTestSharedFrameworkPath>$([MSBuild]::NormalizeDirectory('$(TestHostRootPath)', 'shared', '$(MicrosoftNetCoreAppFrameworkName)', '$(ProductVersion)'))</NETCoreAppTestSharedFrameworkPath>
<MicrosoftNetCoreAppRefPackDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'microsoft.netcore.app.ref'))</MicrosoftNetCoreAppRefPackDir>
<MicrosoftNetCoreAppRefPackRefDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'ref', '$(NetCoreAppCurrent)'))</MicrosoftNetCoreAppRefPackRefDir>
<MicrosoftNetCoreAppRefPackDataDir>$([MSBuild]::NormalizeDirectory('$(MicrosoftNetCoreAppRefPackDir)', 'data'))</MicrosoftNetCoreAppRefPackDataDir>

View File

@ -12,8 +12,14 @@
<Import Project="..\..\Directory.Build.targets" />
<PropertyGroup>
<NetCoreAppCurrentBuildSettings>$(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)</NetCoreAppCurrentBuildSettings>
<NativeBinDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'native', '$(NetCoreAppCurrentBuildSettings)'))</NativeBinDir>
<NetCoreAppCurrentTestHostPath>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'testhost', '$(NetCoreAppCurrentBuildSettings)'))</NetCoreAppCurrentTestHostPath>
<NetCoreAppCurrentTestHostSharedFrameworkPath>$([MSBuild]::NormalizeDirectory('$(NetCoreAppCurrentTestHostPath)', 'shared', '$(MicrosoftNetCoreAppFrameworkName)', '$(ProductVersion)'))</NetCoreAppCurrentTestHostSharedFrameworkPath>
<TargetsForTfmSpecificContentInPackage Condition="'$(IsPackable)' == 'true'">$(TargetsForTfmSpecificContentInPackage);LibIntellisenseDocs</TargetsForTfmSpecificContentInPackage>
<SymbolPackageOutputPath>$(PackageOutputPath)</SymbolPackageOutputPath>
<NoWarn Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' or '$(TargetFrameworkIdentifier)' == '.NETStandard' or ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '3.0')))">$(NoWarn);nullable</NoWarn>
<NoWarn Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' or '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(NoWarn);nullable;CA1052</NoWarn>
<!-- Ignore Obsolete errors within the generated shims that type-forward types.
@ -78,7 +84,7 @@
<!-- binplace to directories for packages -->
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)"
Condition="'$(BuildingNETCoreAppVertical)' == 'true'">
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<PackageFileNativePath Condition="'$(IsNETCoreAppSrc)' == 'true'">$(NETCoreAppPackageRuntimePath)</PackageFileNativePath>
<PackageFileRefPath Condition="'$(IsNETCoreAppRef)' == 'true'">$(NETCoreAppPackageRefPath)</PackageFileRefPath>
<PackageFileRuntimePath Condition="'$(IsNETCoreAppSrc)' == 'true'">$(NETCoreAppPackageRuntimePath)</PackageFileRuntimePath>
@ -98,9 +104,9 @@
<!-- Setup the shared framework directory for testing -->
<BinPlaceTargetFrameworks Include="$(NetCoreAppCurrent)-$(TargetOS)"
Condition="'$(BinPlaceTestSharedFramework)' == 'true'">
<NativePath >$(NETCoreAppTestSharedFrameworkPath)</NativePath>
<RuntimePath Condition="'$(IsNETCoreAppSrc)' == 'true'">$(NETCoreAppTestSharedFrameworkPath)</RuntimePath>
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<NativePath >$(NetCoreAppCurrentTestHostSharedFrameworkPath)</NativePath>
<RuntimePath Condition="'$(IsNETCoreAppSrc)' == 'true'">$(NetCoreAppCurrentTestHostSharedFrameworkPath)</RuntimePath>
</BinPlaceTargetFrameworks>
<!-- Microsoft.NetCore.App.Ref and Microsoft.NetCore.App.Runtime targeting packs -->

View File

@ -3,15 +3,12 @@
<!-- Hardcode version paths in a global location. -->
<NativeVersionFile Condition="'$(TargetOS)' == 'windows'">$(ArtifactsObjDir)_version.h</NativeVersionFile>
<NativeVersionFile Condition="'$(TargetOS)' != 'windows'">$(ArtifactsObjDir)_version.c</NativeVersionFile>
<TargetFramework>$(BuildTargetFramework)</TargetFramework>
<TargetFramework Condition="'$(TargetFramework)' == ''">$(NetCoreAppCurrent)</TargetFramework>
<_BuildNativeArgs>$(TargetArchitecture) $(Configuration) outconfig $(TargetFramework)-$(TargetOS)-$(Configuration)-$(TargetArchitecture) -os $(TargetOS)</_BuildNativeArgs>
<_BuildNativeArgs>$(TargetArchitecture) $(Configuration) outconfig $(NetCoreAppCurrent)-$(TargetOS)-$(Configuration)-$(TargetArchitecture) -os $(TargetOS)</_BuildNativeArgs>
<_BuildNativeArgs Condition="'$(OfficialBuildId)' != ''">$(_BuildNativeArgs) /p:OfficialBuildId="$(OfficialBuildId)"</_BuildNativeArgs>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="native-binplace.proj"
Condition="'$(BuildingNETCoreAppVertical)' == 'true'" />
<ProjectReference Include="native-binplace.proj" />
</ItemGroup>
<Target Name="BuildNativeUnix"
@ -43,8 +40,7 @@
<Target Name="BuildNativeWindows"
BeforeTargets="Build"
Condition="$([MSBuild]::IsOsPlatform(Windows)) and
'$(TargetFramework)' == '$(NetCoreAppCurrent)'">
Condition="$([MSBuild]::IsOsPlatform(Windows))">
<PropertyGroup>
<_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild</_BuildNativeArgs>
</PropertyGroup>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
<TargetFramework>$(BuildTargetFramework)</TargetFramework>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<BinPlaceRuntime>false</BinPlaceRuntime>
<BinPlaceNative>true</BinPlaceNative>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>

View File

@ -39,7 +39,7 @@
<ExceptionFile>$(TargetDir)%(Class)%(Identity).exception.txt</ExceptionFile>
</ExecuteMethod>
<ExecuteMethod>
<Command>$(TestHostRootPath)dotnet exec --runtimeconfig $(TargetDir)$(TargetName).runtimeconfig.json $(_executor) $(AssemblyName) %(Class) %(Identity) %(ExceptionFile) %(Parameters)</Command>
<Command>$(NetCoreAppCurrentTestHostPath)dotnet exec --runtimeconfig $(TargetDir)$(TargetName).runtimeconfig.json $(_executor) $(AssemblyName) %(Class) %(Identity) %(ExceptionFile) %(Parameters)</Command>
</ExecuteMethod>
</ItemGroup>
<Exec Command="%(ExecuteMethod.Command)" WorkingDirectory="$(TargetDir)" />

View File

@ -46,16 +46,16 @@
</ItemGroup>
<Copy SourceFiles="@(HostFxFile)"
DestinationFolder="$(TestHostRootPath)host\fxr\$(ProductVersion)"
DestinationFolder="$(NetCoreAppCurrentTestHostPath)host\fxr\$(ProductVersion)"
SkipUnchangedFiles="true"
UseHardlinksIfPossible="$(UseHardlink)" />
<Copy SourceFiles="@(DotnetExe)"
DestinationFolder="$(TestHostRootPath)"
DestinationFolder="$(NetCoreAppCurrentTestHostPath)"
SkipUnchangedFiles="true"
UseHardlinksIfPossible="$(UseHardlink)" />
<Exec Command="chmod +x $(TestHostRootPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(TargetOS)' != 'windows' and '$(OS)' != 'Windows_NT'"/>
<Exec Command="chmod +x $(NetCoreAppCurrentTestHostPath)%(DotnetExe.Filename)%(DotnetExe.Extension)" Condition="'$(TargetOS)' != 'windows' and '$(OS)' != 'Windows_NT'"/>
</Target>
<Target Name="OverrideRuntimeCoreCLR"

View File

@ -1,7 +1,6 @@
<Project Sdk="Microsoft.Build.Traversal" DefaultTargets="Pack">
<PropertyGroup>
<TraversalGlobalProperties>BuildAllProjects=true</TraversalGlobalProperties>
<AdditionalBuildTargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true'">$(AdditionalBuildTargetFrameworks);package-$(Configuration)</AdditionalBuildTargetFrameworks>
</PropertyGroup>

View File

@ -56,7 +56,7 @@
AfterTargets="BuildExternalsProject"
Inputs="@(SharedFrameworkRuntimeFile)"
Outputs="$(MicrosoftNetCoreAppRuntimePackDir)data\PlatformManifest.txt"
Condition="'$(BuildingNETCoreAppVertical)' == 'true'">
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<GenerateFileVersionProps Files="@(SharedFrameworkRuntimeFile)"
PackageId="$(MicrosoftNetCoreAppFrameworkName).Runtime.$(PackageRID)"
PackageVersion="$(ProductVersion)"
@ -71,7 +71,7 @@
AfterTargets="BuildExternalsProject"
Inputs="@(SharedFrameworkRuntimeFile)"
Outputs="$(MicrosoftNetCoreAppRefPackDataDir)PlatformManifest.txt"
Condition="'$(BuildingNETCoreAppVertical)' == 'true'">
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<GenerateFileVersionProps Files="@(SharedFrameworkRuntimeFile)"
PackageId="$(MicrosoftNetCoreAppFrameworkName).Ref"
PackageVersion="$(ProductVersion)"
@ -84,11 +84,11 @@
<UsingTask TaskName="GenerateTestSharedFrameworkDepsFile" AssemblyFile="$(InstallerTasksAssemblyPath)"/>
<Target Name="GenerateTestSharedFrameworkAssets"
AfterTargets="BuildExternalsProject"
Inputs="$(NETCoreAppTestSharedFrameworkPath)*.*"
Outputs="$(NETCoreAppTestSharedFrameworkPath)$(MicrosoftNetCoreAppFrameworkName).deps.json"
Condition="'$(BinPlaceTestSharedFramework)' == 'true'">
Inputs="$(NetCoreAppCurrentTestHostSharedFrameworkPath)*.*"
Outputs="$(NetCoreAppCurrentTestHostSharedFrameworkPath)$(MicrosoftNetCoreAppFrameworkName).deps.json"
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<!-- Shared framework deps file generation. Produces a test shared-framework deps file. -->
<GenerateTestSharedFrameworkDepsFile SharedFrameworkDirectory="$(NETCoreAppTestSharedFrameworkPath)"
<GenerateTestSharedFrameworkDepsFile SharedFrameworkDirectory="$(NetCoreAppCurrentTestHostSharedFrameworkPath)"
RuntimeGraphFiles="$(RuntimeIdGraphDefinitionFile)"
TargetRuntimeIdentifier="$(PackageRID)" />
</Target>
@ -125,7 +125,7 @@
AfterTargets="BuildExternalsProject"
Inputs="@(RuntimePackLibFile);@(RuntimePackNativeFile)"
Outputs="$(MicrosoftNetCoreAppRuntimePackDir)data\RuntimeList.xml"
Condition="'$(BuildingNETCoreAppVertical)' == 'true'">
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<ItemGroup>
<FrameworkListRootAttribute Include="Name" Value="$(NetCoreAppCurrentBrandName)" />
<FrameworkListRootAttribute Include="TargetFrameworkIdentifier" Value="$(NetCoreAppCurrentIdentifier)" />

View File

@ -14,7 +14,7 @@
<NetCoreAppProject Include="@(_allRef)"
Exclude="@(NonNetCoreAppProject)" />
<GeneratedShimProject Include="shims\generated\*.csproj"
Condition="'$(BuildingNETCoreAppVertical)' == 'true'" />
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''" />
</ItemGroup>
<ItemGroup>
@ -57,7 +57,7 @@
AfterTargets="BuildGeneratedShims"
Inputs="@(RefPackLibFile)"
Outputs="$(MicrosoftNetCoreAppRefPackDataDir)FrameworkList.xml"
Condition="'$(BuildingNETCoreAppVertical)' == 'true'">
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''">
<ItemGroup>
<FrameworkListRootAttribute Include="Name" Value="$(NetCoreAppCurrentBrandName)" />
<FrameworkListRootAttribute Include="TargetFrameworkIdentifier" Value="$(NetCoreAppCurrentIdentifier)" />

View File

@ -12,19 +12,29 @@
"correlation payload", which is the set of files used by all Helix submissions
(which we compress into a single file).
-->
<Project Sdk="Microsoft.Build.NoTargets">
<Project DefaultTargets="RunInParallelForEachScenario">
<PropertyGroup>
<TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
<BuildTargetFramework Condition="'$(TestPackages)' != 'true'">$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(NetCoreAppCurrent)'))</BuildTargetFramework>
<TargetsWindows Condition="'$(TargetOS)' == 'windows'">true</TargetsWindows>
<!-- Helix auto-magically imports local *.props files. We're not going to import the Helix Sdk,
so we need to import those files manually so we can reference the properties defined there.
-->
<Import Project="Directory.Build.props" />
<!-- The Helix correlation payload file -->
<TestArchiveRuntimeFile Condition="'$(TestPackages)' != 'true' and
'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'">$(TestArchiveRuntimeRoot)test-runtime-$(NetCoreAppCurrentBuildSettings).zip</TestArchiveRuntimeFile>
<TestArchiveRuntimeFile Condition="'$(TestPackages)' == 'true'">$(TestArchiveRuntimeRoot)packages-testPayload-$(Configuration).zip</TestArchiveRuntimeFile>
<Target Name="RunInParallelForEachScenario">
<!-- Set the name of the scenario file. Note that this is only used in invocations where $(Scenario) is set
(which is when this project is invoked to call the "CreateOneScenarioTestEnvFile" target). -->
<TestEnvFileName Condition=" '$(TargetsWindows)' == 'true' ">SetStressModes_$(Scenario).cmd</TestEnvFileName>
<TestEnvFileName Condition=" '$(TargetsWindows)' != 'true' ">SetStressModes_$(Scenario).sh</TestEnvFileName>
</PropertyGroup>
<Target Name="RunInParallelForEachScenario"
AfterTargets="Build">
<PropertyGroup>
<!-- This specifies what properties are needed to be passed down as global properties to a child project invocation. -->
<_PropertiesToPass>
RuntimeFlavor=$(RuntimeFlavor);
TargetArchitecture=$(TargetArchitecture);
@ -35,17 +45,14 @@
Creator=$(Creator);
HelixAccessToken=$(HelixAccessToken);
HelixTargetQueues=$(HelixTargetQueues);
BuildTargetFramework=$(BuildTargetFramework);
BuildSettings=$(BuildSettings)
BuildTargetFramework=$(BuildTargetFramework)
</_PropertiesToPass>
</PropertyGroup>
<Message Condition="'$(_Scenarios)' != ''" Importance="High" Text="Using _Scenarios: $(_Scenarios)" />
<Message Importance="High" Text="Using Queues: $(HelixTargetQueues)" />
<Message Importance="High" Text="BuildSettings: $(BuildSettings)" />
<Message Importance="High" Text="BuildTargetFramework: $(BuildTargetFramework)" />
<Message Importance="High" Text="TestArchiveTestsRoot: $(TestArchiveTestsRoot)" />
<Message Importance="High" Text="TestHostRootPath: $(TestHostRootPath)" />
<Message Importance="High" Text="TestArchiveRoot: $(TestArchiveRoot)" />
<Message Importance="High" Text="TestArchiveRuntimeRoot: $(TestArchiveRuntimeRoot)" />
<Message Condition="'$(TestArchiveRuntimeFile)' != ''" Importance="High" Text="TestArchiveRuntimeFile: $(TestArchiveRuntimeFile)" />
@ -54,7 +61,7 @@
<MSBuild Projects="$(MSBuildProjectFile)" Targets="PrepareCorrelationPayloadDirectory" Properties="Scenarios=$(_Scenarios)" />
<PropertyGroup>
<PerScenarioProjectFile>$(MSBuildProjectDirectory)\sendtohelixhelp.proj</PerScenarioProjectFile>
<PerScenarioProjectFile>$(MSBuildThisFileDirectory)sendtohelixhelp.proj</PerScenarioProjectFile>
</PropertyGroup>
<ItemGroup>
@ -79,21 +86,6 @@
</Target>
<PropertyGroup>
<TargetsWindows Condition="'$(TargetOS)' == 'windows'">true</TargetsWindows>
<BuildTargetFramework Condition="'$(TestPackages)' != 'true'">$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(NetCoreAppCurrent)'))</BuildTargetFramework>
<!-- The Helix correlation payload file -->
<TestArchiveRuntimeFile Condition="'$(TestPackages)' != 'true' and
'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)'">$(TestArchiveRuntimeRoot)test-runtime-$(BuildSettings).zip</TestArchiveRuntimeFile>
<TestArchiveRuntimeFile Condition="'$(TestPackages)' == 'true'">$(TestArchiveRuntimeRoot)packages-testPayload-$(Configuration).zip</TestArchiveRuntimeFile>
</PropertyGroup>
<PropertyGroup>
<!-- Set the name of the scenario file. Note that this is only used in invocations where $(Scenario) is set
(which is when this project is invoked to call the "CreateOneScenarioTestEnvFile" target).
-->
<TestEnvFileName Condition=" '$(TargetsWindows)' == 'true' ">SetStressModes_$(Scenario).cmd</TestEnvFileName>
<TestEnvFileName Condition=" '$(TargetsWindows)' != 'true' ">SetStressModes_$(Scenario).sh</TestEnvFileName>
</PropertyGroup>
<Target Name="CreateOneScenarioTestEnvFile">
@ -102,7 +94,7 @@
<Error Condition="'$(Scenario)' == ''" Text="No Scenario specified" />
<PropertyGroup>
<TestEnvFilePath>$(TestHostRootPath)$(TestEnvFileName)</TestEnvFilePath>
<TestEnvFilePath>$(NetCoreAppCurrentTestHostPath)$(TestEnvFileName)</TestEnvFilePath>
</PropertyGroup>
<ItemGroup>
@ -133,17 +125,19 @@
<MSBuild Projects="@(_ProjectsToBuild)" Targets="CreateOneScenarioTestEnvFile" StopOnFirstFailure="true" />
</Target>
<!--
We need to include all dlls in the runtime path as inputs to make it really incremental. If we use the root folder,
if a dll is updated, the folder's timestamp is not updated, therefore skipped.
-->
<ItemGroup>
<_RuntimeInputs Include="$(TestHostRootPath)**/*.dll" />
<Target Name="_CollectRuntimeInputs">
<!--
We need to include all dlls in the runtime path as inputs to make it really incremental. If we use the root folder,
if a dll is updated, the folder's timestamp is not updated, therefore skipped.
-->
<ItemGroup>
<_RuntimeInput Include="$(NetCoreAppCurrentTestHostPath)**\*.dll" />
<!-- Add the scenario TestEnv batch files -->
<_RuntimeInputs Condition=" '$(Scenarios)' != '' and '$(TargetsWindows)' == 'true' " Include="$(TestHostRootPath)**/*.cmd" />
<_RuntimeInputs Condition=" '$(Scenarios)' != '' and '$(TargetsWindows)' != 'true' " Include="$(TestHostRootPath)**/*.sh" />
</ItemGroup>
<!-- Add the scenario TestEnv batch files -->
<_RuntimeInput Condition=" '$(Scenarios)' != '' and '$(TargetsWindows)' == 'true' " Include="$(NetCoreAppCurrentTestHostPath)**\*.cmd" />
<_RuntimeInput Condition=" '$(Scenarios)' != '' and '$(TargetsWindows)' != 'true' " Include="$(NetCoreAppCurrentTestHostPath)**\*.sh" />
</ItemGroup>
</Target>
<Target Name="IncludeDumpDocsInTesthost"
Condition="'$(RuntimeFlavor)' == 'CoreCLR'">
@ -155,13 +149,13 @@
</ItemGroup>
<Copy SourceFiles="@(DebugDocsFiles)"
DestinationFolder="$(TestHostRootPath)"
DestinationFolder="$(NetCoreAppCurrentTestHostPath)"
SkipUnchangedFiles="true" />
</Target>
<Target Name="CompressRuntimeDirectory"
DependsOnTargets="IncludeDumpDocsInTesthost"
Inputs="@(_RuntimeInputs);@(TestArchiveRuntimeDependency)"
DependsOnTargets="IncludeDumpDocsInTesthost;_CollectRuntimeInputs"
Inputs="@(_RuntimeInput);@(TestArchiveRuntimeDependency)"
Outputs="$(TestArchiveRuntimeFile)"
Condition="'$(TestPackages)' != 'true' and
'$(TargetsMobile)' != 'true' and
@ -174,7 +168,7 @@
<Message Importance="High" Text="Creating directory $(TestArchiveRuntimeRoot)" />
<MakeDir Directories="$(TestArchiveRuntimeRoot)" />
<ZipDirectory SourceDirectory="$(TestHostRootPath)"
<ZipDirectory SourceDirectory="$(NetCoreAppCurrentTestHostPath)"
DestinationFile="$(TestArchiveRuntimeFile)"
Overwrite="true" />

View File

@ -41,11 +41,11 @@
<HelixArchitecture>$(TargetArchitecture)</HelixArchitecture>
<!-- This property is used to show the tests results in Azure Dev Ops. By setting this property the
test run name will be displayed as $(BuildSettings)-$(HelixTargetQueue)
test run name will be displayed as $(BuildTargetFramework)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)-$(HelixTargetQueue)
In the multi-scenario case, we append the scenario name to this test name prefix to distinguish the different scenario results.
-->
<TestRunNamePrefix>$(BuildSettings)-</TestRunNamePrefix>
<TestRunNamePrefix>$(BuildTargetFramework)-$(TargetOS)-$(Configuration)-$(TargetArchitecture)-</TestRunNamePrefix>
<TestRunNamePrefix Condition="'$(TestRunNamePrefixSuffix)' != ''">$(TestRunNamePrefix)$(TestRunNamePrefixSuffix)-</TestRunNamePrefix>
<TestRunNamePrefix Condition="'$(Scenario)' != ''">$(TestRunNamePrefix)$(Scenario)-</TestRunNamePrefix>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>$([MSBuild]::ValueOrDefault('$(BuildTargetFramework)', '$(NetCoreAppCurrent)'))</TargetFramework>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<!-- Set to true to build this project -->
<BaselineApiCompat Condition="'$(BaselineApiCompat)' == ''">false</BaselineApiCompat>
<PreviousNetCoreApp>net5.0</PreviousNetCoreApp>

View File

@ -6,7 +6,6 @@
<PropertyGroup>
<IsNETCoreAppSrc>true</IsNETCoreAppSrc>
<IsNETCoreAppRef>true</IsNETCoreAppRef>
<NuGetTargetMoniker Condition="'$(NuGetTargetMoniker)' == ''">$(TargetFramework)</NuGetTargetMoniker>
</PropertyGroup>
<PropertyGroup>
@ -23,7 +22,9 @@
<NETStandard21RefPath>$(NuGetPackageRoot)netstandard.library.ref\$(NETStandardLibraryRefVersion)\ref\netstandard2.1\</NETStandard21RefPath>
</PropertyGroup>
<ItemGroup Condition="'$(MSBuildProjectName)' == 'System.Runtime' or '$(MSBuildProjectName)' == 'mscorlib' or '$(MSBuildProjectName)' == 'netstandard'">
<ItemGroup Condition="'$(MSBuildProjectName)' == 'System.Runtime' or
'$(MSBuildProjectName)' == 'mscorlib' or
'$(MSBuildProjectName)' == 'netstandard'">
<!-- Omit System.Void since C# doesn't permit the use of the `System.Void`
typename and instead requires callers to use the `void` keyword. -->
<GenFacadesOmitType Include="System.Void" />

View File

@ -2,7 +2,7 @@
<!-- IMPORTANT: please rebuild generateShims.proj when making changes to this file -->
<ItemGroup>
<NetFxReference Include="mscorlib" />
<NetFxReference Condition="'$(TargetFramework)' != 'netcoreapp2.0'" Include="Microsoft.VisualBasic" />
<NetFxReference Include="Microsoft.VisualBasic" />
<NetFxReference Include="System" />
<NetFxReference Include="System.ComponentModel.DataAnnotations" />
<NetFxReference Include="System.Configuration" />

View File

@ -17,7 +17,7 @@
<ManualShimProject Include="shims\manual\*.csproj" />
<ApiCompatProject Include="shims\ApiCompat.proj"
Condition="'$(DotNetBuildFromSource)' != 'true' and
'$(BuildingNETCoreAppVertical)' == 'true' and
('$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == '') and
'$(RunApiCompat)' != 'false'" />
</ItemGroup>
@ -47,8 +47,8 @@
Properties="$(TraversalGlobalProperties)" />
</Target>
<Import Condition="'$(BuildingNetCoreAppVertical)' == 'true'"
Project="$(MSBuildThisFileDirectory)\illink-trimassemblies.targets" />
<Import Project="$(MSBuildThisFileDirectory)illink-trimassemblies.targets"
Condition="'$(BuildTargetFramework)' == '$(NetCoreAppCurrent)' or '$(BuildTargetFramework)' == ''" />
<Target Name="RunApiCompat"
Condition="'@(ApiCompatProject)' != ''"

View File

@ -1,8 +1,4 @@
<Project Sdk="Microsoft.Build.Traversal" DefaultTargets="Pack">
<PropertyGroup>
<TraversalGlobalProperties>BuildAllProjects=true</TraversalGlobalProperties>
</PropertyGroup>
<ItemGroup Condition="'$(TargetOS)' == 'Android'">
<ProjectReference Include="Microsoft.NET.Runtime.Android.Sample.Mono\Microsoft.NET.Runtime.Android.Sample.Mono.pkgproj" />
</ItemGroup>