Migrate pkgproj/depproj to Arcade SDK
authorDavis Goodin <dagood@microsoft.com>
Fri, 21 Jun 2019 18:41:59 +0000 (13:41 -0500)
committerDavis Goodin <dagood@microsoft.com>
Fri, 21 Jun 2019 21:39:49 +0000 (16:39 -0500)
This simplifies the build significantly. Building a depproj directly does what you'd expect, building a pkgproj directly does what you expect; a deep understanding should be less important.

Previously, an MSBuild task asked each depproj/pkgproj what configurations it should build under, then these configurations were filtered, then another MSBuild task built each of those. There were several phases of traversal build.

Now, each depproj is built only once, and each pkgproj is built only once (although it still may call itself to create rid-specific packages). Dependencies are now used to maintain the order that used to be maintained by phases. This also, in theory, opens the build up for better parallelization, but I haven't timed it.

Commit migrated from https://github.com/dotnet/core-setup/commit/11135d2b8cd07d7873042c79ab1061297d6a9be0

53 files changed:
src/installer/Directory.Build.targets
src/installer/packaging.stubs.targets [new file with mode: 0644]
src/installer/pkg/Directory.Build.props
src/installer/pkg/Directory.Build.targets
src/installer/pkg/packaging-tools/acquire-wix/acquire-wix.proj [new file with mode: 0644]
src/installer/pkg/packaging-tools/framework.dependency.targets
src/installer/pkg/packaging-tools/framework.packaging.targets
src/installer/pkg/packaging-tools/installer.targets [new file with mode: 0644]
src/installer/pkg/packaging-tools/packaging-tools.props
src/installer/pkg/packaging-tools/packaging-tools.targets
src/installer/pkg/packaging-tools/sharedFramework/Directory.Build.props [deleted file]
src/installer/pkg/packaging-tools/windows/wix.targets
src/installer/pkg/projects/Directory.Build.props
src/installer/pkg/projects/Directory.Build.targets
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.pkgproj
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/runtime.FreeBSD.Microsoft.NETCore.DotNetAppHost.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/runtime.OSX.Microsoft.NETCore.DotNetAppHost.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/runtime.Unix.Microsoft.NETCore.DotNetAppHost.props [moved from src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/runtime.Linux.Microsoft.NETCore.DotNetAppHost.props with 93% similarity]
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/runtime.Windows_NT.Microsoft.NETCore.DotNetAppHost.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.pkgproj
src/installer/pkg/projects/Microsoft.NETCore.DotNetHost/runtime.FreeBSD.Microsoft.NETCore.DotNetHost.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHost/runtime.OSX.Microsoft.NETCore.DotNetHost.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHost/runtime.Unix.Microsoft.NETCore.DotNetHost.props [moved from src/installer/pkg/projects/Microsoft.NETCore.DotNetHost/runtime.Linux.Microsoft.NETCore.DotNetHost.props with 91% similarity]
src/installer/pkg/projects/Microsoft.NETCore.DotNetHost/runtime.Windows_NT.Microsoft.NETCore.DotNetHost.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/Microsoft.NETCore.DotNetHostPolicy.pkgproj
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/runtime.FreeBSD.Microsoft.NETCore.DotNetHostPolicy.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/runtime.OSX.Microsoft.NETCore.DotNetHostPolicy.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/runtime.Unix.Microsoft.NETCore.DotNetHostPolicy.props [moved from src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/runtime.Linux.Microsoft.NETCore.DotNetHostPolicy.props with 89% similarity]
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/runtime.Windows_NT.Microsoft.NETCore.DotNetHostPolicy.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/Microsoft.NETCore.DotNetHostResolver.pkgproj
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/runtime.FreeBSD.Microsoft.NETCore.DotNetHostResolver.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/runtime.OSX.Microsoft.NETCore.DotNetHostResolver.props
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/runtime.Unix.Microsoft.NETCore.DotNetHostResolver.props [moved from src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/runtime.Linux.Microsoft.NETCore.DotNetHostResolver.props with 91% similarity]
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/runtime.Windows_NT.Microsoft.NETCore.DotNetHostResolver.props
src/installer/pkg/projects/netcoreapp/pkg/Directory.Build.props
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Host.pkgproj
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Ref.pkgproj
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Runtime.pkgproj
src/installer/pkg/projects/netcoreapp/pkg/legacy/Directory.Build.props
src/installer/pkg/projects/netcoreapp/pkg/legacy/Microsoft.NETCore.App.Internal.pkgproj
src/installer/pkg/projects/netcoreapp/pkg/legacy/Microsoft.NETCore.App.pkgproj
src/installer/pkg/projects/netcoreapp/pkg/workaround/Microsoft.NETCore.App.pkgproj
src/installer/pkg/projects/netcoreapp/src/netcoreapp.depproj
src/installer/pkg/projects/netstandard/Directory.Build.props
src/installer/pkg/projects/netstandard/pkg/Directory.Build.props
src/installer/pkg/projects/netstandard/pkg/NETStandard.Library.Ref.pkgproj
src/installer/pkg/projects/netstandard/src/netstandard.depproj
src/installer/pkg/projects/windowsdesktop/Directory.Build.props
src/installer/pkg/projects/windowsdesktop/pkg/Directory.Build.props
src/installer/pkg/projects/windowsdesktop/pkg/Microsoft.WindowsDesktop.App.Ref.pkgproj
src/installer/pkg/projects/windowsdesktop/pkg/Microsoft.WindowsDesktop.App.Runtime.pkgproj
src/installer/pkg/projects/windowsdesktop/pkg/Microsoft.WindowsDesktop.App.pkgproj
src/installer/pkg/projects/windowsdesktop/src/windowsdesktop.depproj

index 98ebed3..939e3c1 100644 (file)
@@ -1,4 +1,11 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" InitialTargets="CheckForBuildTools" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\Directory.Build.targets" />
+<Project>
+
+  <!--
+    Import stubs for compatibility with packaging tools, if not building a pkgproj. Ordinarily,
+    listing this before the ../Directory.Build.targets import would be sufficient, but the packaging
+    tools targets are already imported before this file.
+  -->
+  <Import Project="packaging.stubs.targets" Condition="'$(MSBuildProjectExtension)' != '.pkgproj'" />
+
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.targets))\Directory.Build.targets" />
 </Project>
diff --git a/src/installer/packaging.stubs.targets b/src/installer/packaging.stubs.targets
new file mode 100644 (file)
index 0000000..120f000
--- /dev/null
@@ -0,0 +1,11 @@
+<Project>
+
+  <!--
+    Provide default stub targets for packaging tasks, if not defined. Allows freer use of
+    ProjectReferences in pkgproj.
+  -->
+  <Target Name="GetFilesToPackage" />
+  <Target Name="GetDependenciesToPackage" />
+  <Target Name="DetermineRuntimeDependencies" />
+
+</Project>
index 8dea531..c94910a 100644 (file)
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" InitialTargets="ValidateArgs" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\Directory.Build.props" />
+<Project>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" />
 
   <PropertyGroup>
     <Platform>$(TargetArchitecture)</Platform>
@@ -8,10 +7,6 @@
   </PropertyGroup>
 
   <PropertyGroup>
-    <VersionTxtFile>$(ObjDir)version.txt</VersionTxtFile>
-  </PropertyGroup>
-
-  <PropertyGroup>
     <PackageLicenseFile>$(ProjectDir)LICENSE.TXT</PackageLicenseFile>
     <PackageThirdPartyNoticesFile>$(ProjectDir)THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile>
     <LicenseUrl>https://github.com/dotnet/core-setup/blob/master/LICENSE.TXT</LicenseUrl>
     <SkipIndexCheck>true</SkipIndexCheck>
   </PropertyGroup>
 
+  <ItemGroup>
+    <PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingPackageVersion)" />
+  </ItemGroup>
+
   <PropertyGroup>
     <PackagingToolsDir>$(MSBuildThisFileDirectory)packaging-tools/</PackagingToolsDir>
 
     <InstallerSourceOSPlatformConfig Condition="'$(InstallerSourceOSPlatformConfig)' == ''">$(OSPlatformConfig)</InstallerSourceOSPlatformConfig>
   </PropertyGroup>
 
-  <PropertyGroup>
-    <ProductBrandPrefix Condition="'$(ProductBrandPrefix)' == ''">Microsoft .NET Core</ProductBrandPrefix>
-    <ProductBrandSuffix>$(ProductionVersion)</ProductBrandSuffix>
-    <ProductBrandSuffix Condition="'$(ReleaseBrandSuffix)'!=''">$(ProductionVersion) $(ReleaseBrandSuffix)</ProductBrandSuffix>
-    <SharedHostBrandName>$(ProductBrandPrefix) Host - $(ProductBrandSuffix)</SharedHostBrandName>
-    <HostFxrBrandName>$(ProductBrandPrefix) Host FX Resolver - $(ProductBrandSuffix)</HostFxrBrandName>
-    <TargetingPackBrandName>$(ProductBrandPrefix) Targeting Pack - $(ProductBrandSuffix)</TargetingPackBrandName>
-    <AppHostPackBrandName>$(ProductBrandPrefix) AppHost Pack - $(ProductBrandSuffix)</AppHostPackBrandName>
-    <SharedFrameworkBrandName>$(ProductBrandPrefix) Runtime - $(ProductBrandSuffix)</SharedFrameworkBrandName>
-  </PropertyGroup>
-
   <ItemGroup>
     <PackageIndex Include="$(PackageIndexFile)" />
   </ItemGroup>
   </Target>
 
   <Target Name="ValidatePreReleaseStrings" Condition="'$(StabilizePackageVersion)'!='true'">
-    <Error Condition="'$(PreReleaseLabel)'==''" Text="PreReleaseLabel is undefined" />
+    <Error Condition="'$(PreReleaseVersionLabel)'==''" Text="PreReleaseVersionLabel is undefined" />
     <Error Condition="'$(BuildNumberMajor)'==''" Text="BuildNumberMajor is undefined" />
     <Error Condition="'$(BuildNumberMinor)'==''" Text="BuildNumberMinor is undefined" />
   </Target>
index d8b9fb2..e087c79 100644 (file)
@@ -1,15 +1,34 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" InitialTargets="CheckForBuildTools" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\Directory.Build.targets" />
+<Project>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.targets))\Directory.Build.targets" />
+
   <PropertyGroup>
     <RuntimeIdGraphDefinitionFile>$(PackagesDir)$(PlatformPackageId.ToLowerInvariant())\$(MicrosoftNETCorePlatformsPackageVersion)\runtime.json</RuntimeIdGraphDefinitionFile>
   </PropertyGroup>
 
-  <UsingTask TaskName="DownloadFilesFromUrl" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
-  <UsingTask TaskName="ZipFileExtractToDirectory" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
+  <!--
+    Get branding names for the installers.
+  -->
+  <Target Name="GetInstallerBrandingNames"
+          DependsOnTargets="GetProductVersions">
+    <PropertyGroup Condition="'$(PreReleaseVersionLabel)' != '' and $(PreReleaseVersionLabel.StartsWith('preview'))">
+      <!-- Convert 'preview7' to 'Preview 7'. -->
+      <ReleaseBrandSuffix>$(PreReleaseVersionLabel.Substring(0,1).ToUpperInvariant())</ReleaseBrandSuffix>
+      <ReleaseBrandSuffix>$(ReleaseBrandSuffix)$(PreReleaseVersionLabel.Substring(1,6))</ReleaseBrandSuffix>
+      <ReleaseBrandSuffix>$(ReleaseBrandSuffix) $(PreReleaseVersionLabel.Substring(7))</ReleaseBrandSuffix>
+    </PropertyGroup>
 
-  <UsingTask TaskName="GenerateGuidFromName" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll" />
-  <UsingTask TaskName="GenerateMsiVersion" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll" />
+    <PropertyGroup>
+      <ProductBrandPrefix Condition="'$(ProductBrandPrefix)' == ''">Microsoft .NET Core</ProductBrandPrefix>
+      <ProductBrandSuffix>$(ProductionVersion)</ProductBrandSuffix>
+      <ProductBrandSuffix Condition="'$(ReleaseBrandSuffix)'!=''">$(ProductionVersion) $(ReleaseBrandSuffix)</ProductBrandSuffix>
+
+      <SharedHostBrandName>$(ProductBrandPrefix) Host - $(ProductBrandSuffix)</SharedHostBrandName>
+      <HostFxrBrandName>$(ProductBrandPrefix) Host FX Resolver - $(ProductBrandSuffix)</HostFxrBrandName>
+      <TargetingPackBrandName>$(ProductBrandPrefix) Targeting Pack - $(ProductBrandSuffix)</TargetingPackBrandName>
+      <AppHostPackBrandName>$(ProductBrandPrefix) AppHost Pack - $(ProductBrandSuffix)</AppHostPackBrandName>
+      <SharedFrameworkBrandName>$(ProductBrandPrefix) Runtime - $(ProductBrandSuffix)</SharedFrameworkBrandName>
+    </PropertyGroup>
+  </Target>
 
   <!-- Create deb tool package and set up the project that consumes it as a CLI tool. -->
   <Target Name="InitializeDotnetDebTool">
 
   <!--
     Acquire WiX tools, if not present.
-
-    Adapted from https://github.com/dotnet/core-sdk/blob/6aed0cd3614f9b740cfb3f21fdb795bab53ef7e9/src/redist/targets/GenerateMSIs.targets#L80-L102
   -->
   <Target Name="AcquireWix"
           DependsOnTargets="GetAcquireWixProperties"
-          Condition="'$(GenerateMSI)' == 'true'"
-          Inputs="$(WixDownloadSentinel)"
-          Outputs="$(WixDestinationPath)">
-    <!-- Setup sentinel to take advantage of incrementality -->
-    <MakeDir Directories="$(WixToolsDir)" />
-    <WriteLinesToFile
-      File="$(WixDownloadSentinel)"
-      Lines="$(WixVersion)"
-      Overwrite="true"
-      Encoding="Unicode" />
-
-    <ItemGroup>
-      <_wixToolDownload
-        Include="WixTool"
-        Url="$(WixDownloadUrl)"
-        DestinationDir="$(WixToolsDir)" />
-    </ItemGroup>
-
-    <DownloadFilesFromUrl Items="@(_wixToolDownload)" />
-
-    <ZipFileExtractToDirectory
-      SourceArchive="$(WixDestinationPath)"
-      DestinationDirectory="$(WixToolsDir)" />
+          Condition="'$(GenerateMSI)' == 'true'">
+    <MSBuild Projects="$(AcquireWixProjectFile)" Targets="AcquireWixCore" />
   </Target>
 
   <Target Name="GetAcquireWixProperties">
     <PropertyGroup>
+      <AcquireWixProjectFile>$(PackagingToolsDir)acquire-wix\acquire-wix.proj</AcquireWixProjectFile>
       <WixDownloadFilename>wix.$(WixVersion).zip</WixDownloadFilename>
       <WixDownloadUrl>https://dotnetcli.azureedge.net/build/wix/$(WixDownloadFilename)</WixDownloadUrl>
       <WixDestinationPath>$(WixToolsDir)$(WixDownloadFilename)</WixDestinationPath>
     </PropertyGroup>
   </Target>
 
+  <UsingTask TaskName="GenerateCurrentVersion" AssemblyFile="$(LocalBuildToolsTaskFile)" />
+
   <Target Name="GenerateMsiVersionString">
+    <PropertyGroup>
+      <VersionPadding Condition="'$(VersionPadding)'==''">5</VersionPadding>
+      <VersionComparisonDate>2016-01-01</VersionComparisonDate>
+    </PropertyGroup>
+
+    <GenerateCurrentVersion
+      SeedDate="$([System.DateTime]::Now.ToString(yyyy-MM-dd))"
+      OfficialBuildId="$(OfficialBuildId)"
+      ComparisonDate="$(VersionComparisonDate)"
+      Padding="$(VersionPadding)">
+      <Output PropertyName="BuildNumberMajor" TaskParameter="GeneratedVersion" />
+      <Output PropertyName="BuildNumberMinor" TaskParameter="GeneratedRevision" />
+    </GenerateCurrentVersion>
+
     <GenerateMsiVersion
       Major="$(MajorVersion)"
       Minor="$(MinorVersion)"
diff --git a/src/installer/pkg/packaging-tools/acquire-wix/acquire-wix.proj b/src/installer/pkg/packaging-tools/acquire-wix/acquire-wix.proj
new file mode 100644 (file)
index 0000000..48f58f1
--- /dev/null
@@ -0,0 +1,32 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <UsingTask TaskName="DownloadFile" AssemblyFile="$(ArcadeSdkBuildTasksAssembly)" />
+
+  <!--
+    Acquire WiX tools, if not present.
+
+    Adapted from https://github.com/dotnet/core-sdk/blob/6aed0cd3614f9b740cfb3f21fdb795bab53ef7e9/src/redist/targets/GenerateMSIs.targets#L80-L102
+  -->
+  <Target Name="AcquireWixCore"
+          DependsOnTargets="GetAcquireWixProperties"
+          Inputs="$(WixDownloadSentinel)"
+          Outputs="$(WixDestinationPath)">
+    <!-- Setup sentinel to take advantage of incrementality -->
+    <MakeDir Directories="$(WixToolsDir)" />
+    <WriteLinesToFile
+      File="$(WixDownloadSentinel)"
+      Lines="$(WixVersion)"
+      Overwrite="true"
+      Encoding="Unicode" />
+
+    <DownloadFile
+      Uri="$(WixDownloadUrl)"
+      DestinationPath="$(WixDestinationPath)"
+      Overwrite="true" />
+
+    <Unzip
+      SourceFiles="$(WixDestinationPath)"
+      DestinationFolder="$(WixToolsDir)" />
+  </Target>
+
+</Project>
index 2059ff9..7e9d47e 100644 (file)
@@ -5,21 +5,25 @@
 
   <!-- Fetches all the file items from the packages that we want to redist -->
   <Target Name="GetFilesFromPackages">
-    <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' != ''">
+    <ItemGroup>
       <!-- RID-specific: include all runtime files. -->
-      <FilesToPackage Include="@(ReferenceCopyLocalPaths)">
+      <RidSpecificFilesToPackage Include="@(ReferenceCopyLocalPaths)">
         <!-- ResolveNugetPackageAssets doesn't preserve the asset type (native),
              calculate it by looking for native in the path -->
         <IsNative Condition="$([System.String]::new('%(Identity)').ToLowerInvariant().Replace('\', '/').Contains('/native/'))">true</IsNative>
-      </FilesToPackage>
-      <FilesToPackage>
-        <TargetPath Condition="'%(FilesToPackage.IsNative)' != 'true'">runtimes/$(NuGetRuntimeIdentifier)/lib/$(PackageTargetFramework)</TargetPath>
-        <TargetPath Condition="'%(FilesToPackage.IsNative)' == 'true'">runtimes/$(NuGetRuntimeIdentifier)/native</TargetPath>
-      </FilesToPackage>
+      </RidSpecificFilesToPackage>
+      <RidSpecificFilesToPackage>
+        <TargetPath Condition="'%(RidSpecificFilesToPackage.IsNative)' != 'true'">runtimes/$(PackageRID)/lib/$(PackageTargetFramework)</TargetPath>
+        <TargetPath Condition="'%(RidSpecificFilesToPackage.IsNative)' == 'true'">runtimes/$(PackageRID)/native</TargetPath>
+      </RidSpecificFilesToPackage>
       <!-- Ensure localization resource files make it to their subdirs. -->
-      <FilesToPackage Condition="'%(FilesToPackage.DestinationSubDirectory)' != ''">
-        <TargetPath>%(FilesToPackage.TargetPath)/%(FilesToPackage.DestinationSubDirectory)</TargetPath>
-      </FilesToPackage>
+      <RidSpecificFilesToPackage Condition="'%(RidSpecificFilesToPackage.DestinationSubDirectory)' != ''">
+        <TargetPath>%(RidSpecificFilesToPackage.TargetPath)/%(RidSpecificFilesToPackage.DestinationSubDirectory)</TargetPath>
+      </RidSpecificFilesToPackage>
+    </ItemGroup>
+
+    <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' != ''">
+      <FilesToPackage Include="@(RidSpecificFilesToPackage)" />
     </ItemGroup>
 
     <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' == ''">
   </Target>
 
   <Target Name="GetFilesToPackage"
-          DependsOnTargets="ResolveNuGetPackages;GetFilesFromPackages"
+          DependsOnTargets="ResolveReferences;GetFilesFromPackages"
           Returns="@(FilesToPackage)" />
 
   <Target Name="GetDependenciesToPackage"
           Condition="'@(DependenciesToPackage)' != ''"
-          DependsOnTargets="ResolveNuGetPackages"
+          DependsOnTargets="ResolveReferences"
           Returns="@(_DependenciesToPackageWithVersion)">
     <ItemGroup>
       <!-- intersect ReferencedPackage with DependenciesToPackage -->
     <Message Importance="low" Text="%(_DependenciesToPackageWithVersion.Identity) : %(_DependenciesToPackageWithVersion.Version) : %(_DependenciesToPackageWithVersion.TargetFramework)" />
   </Target>
 
-  <!--
-    When performing a restore, do so in a separate MSBuild call, removing any properties that don't
-    affect restore. This allows MSBuild to nicely handle parallel exclusivity.
-
-    Without this, the irrelevant properties cause a cache miss. Both restores run at the same time
-    with the same intermediate location, causing file lock errors.
-  -->
-  <Target Name="ParallelSafeRestore"
-          BeforeTargets="RestorePackages"
-          Condition="'$(InParallelSafeRestore)' != 'true'">
-    <MSBuild
-      Projects="$(MSBuildProjectFullPath)"
-      Targets="RestorePackages"
-      RemoveProperties="BaseId;IdPrefix"
-      Properties="
-        RestorePackages=true;
-        InParallelSafeRestore=true" />
-  </Target>
-
   <!-- Creates the *.versions.txt file describing where data in this package came from. -->
   <Target Name="GenerateHashVersionsFile"
           DependsOnTargets="GetDependencyVersionFiles"
                        Overwrite="true"/>
   </Target>
 
-  <!--
-    Stub DetermineRuntimeDependencies target so that when GenerateRuntimeDependencies builds this
-    target on the depproj, the build doesn't fail. BuildTools gives pkgproj a default implementation
-    that depproj doesn't get.
-    remove when fixing https://github.com/dotnet/buildtools/issues/1273
-  -->
-  <Target Name="DetermineRuntimeDependencies" />
-
   <Target Name="AddCrossgenToolPackageReferences"
           BeforeTargets="CollectPackageReferences">
     <ItemGroup>
     Get paths from packages that are needed for crossgen. Only relevant for runtime-specific builds.
   -->
   <Target Name="GetCorePackagePaths"
-          Condition="'$(NuGetRuntimeIdentifier)' != ''"
-          DependsOnTargets="ResolveNuGetPackages">
+          DependsOnTargets="ResolveReferences">
     <PropertyGroup>
-      <_runtimePackageId>transport.runtime.$(NuGetRuntimeIdentifier).$(MicrosoftNETCoreRuntimeCoreCLRPackage.ToLowerInvariant())</_runtimePackageId>
+      <_runtimePackageId>transport.runtime.$(PackageRID).$(MicrosoftNETCoreRuntimeCoreCLRPackage.ToLowerInvariant())</_runtimePackageId>
       <_runtimePackageVersion>$(MicrosoftNETCoreRuntimeCoreCLRPackageVersion)</_runtimePackageVersion>
 
       <_runtimePackageDir>$(PackagesDir)$(_runtimePackageId)/$(_runtimePackageVersion)/</_runtimePackageDir>
-      <_jitPackageDir>$(PackagesDir)transport.runtime.$(NuGetRuntimeIdentifier).microsoft.netcore.jit/$(MicrosoftNETCoreRuntimeCoreCLRPackageVersion)/</_jitPackageDir>
-      <_corefxPackageDir>$(PackagesDir)runtime.$(NuGetRuntimeIdentifier).$(MicrosoftPrivateCoreFxNETCoreAppPackage.ToLowerInvariant())/$(MicrosoftPrivateCoreFxNETCoreAppPackageVersion)/</_corefxPackageDir>
+      <_jitPackageDir>$(PackagesDir)transport.runtime.$(PackageRID).microsoft.netcore.jit/$(MicrosoftNETCoreRuntimeCoreCLRPackageVersion)/</_jitPackageDir>
+      <_corefxPackageDir>$(PackagesDir)runtime.$(PackageRID).$(MicrosoftPrivateCoreFxNETCoreAppPackage.ToLowerInvariant())/$(MicrosoftPrivateCoreFxNETCoreAppPackageVersion)/</_corefxPackageDir>
       <_winmdPackageDir>$(PackagesDir)$(MicrosoftTargetingPackPrivateWinRTPackage.ToLowerInvariant())/$(MicrosoftTargetingPackPrivateWinRTPackageVersion)/</_winmdPackageDir>
     </PropertyGroup>
 
   </Target>
 
   <Target Name="GetCrossgenToolPaths"
-          Condition="'$(NuGetRuntimeIdentifier)' != ''"
           DependsOnTargets="GetCorePackagePaths">
     <ItemGroup>
       <!-- Find crossgen tool assets in package cache to allow ExcludeAssets=All. -->
 
   <!-- Prepares all items for cross-gen and replaces package file items with their cross-gen'ed equivalents -->
   <Target Name="PrepareForCrossGen"
-          Condition="'$(NuGetRuntimeIdentifier)' != '' AND '$(DisableCrossgen)' != 'true'"
-          DependsOnTargets="
-            GetCorePackagePaths;
-            GetFilesFromPackages">
+          Condition="'$(DisableCrossgen)' != 'true'"
+          DependsOnTargets="GetFilesFromPackages">
     <PropertyGroup>
-      <_crossGenIntermediatePath>$(IntermediateOutputPath)/crossgen</_crossGenIntermediatePath>
+      <_crossGenIntermediatePath>$(IntermediateOutputPath)crossgen\</_crossGenIntermediatePath>
     </PropertyGroup>
     
     <ItemGroup>
         Resource DLLs in 'cs/', 'de/', ... subdirectories.
       -->
       <_filesToCrossGen
-        Include="@(FilesToPackage)"
+        Include="@(RidSpecificFilesToPackage)"
         Condition="
-          '%(FilesToPackage.IsNative)' != 'true' AND
+          '%(RidSpecificFilesToPackage.IsNative)' != 'true' AND
           '%(FileName)' != 'System.Private.CoreLib' AND
           '%(FileName)' != 'mscorlib' AND
           '%(Extension)' == '.dll' AND
-          '%(FilesToPackage.DestinationSubDirectory)' == '' AND
+          '%(RidSpecificFilesToPackage.DestinationSubDirectory)' == '' AND
           (
             '%(FileName)' != 'System.Runtime.WindowsRuntime' Or
             '$(OsEnvironment)'=='Windows_NT'
           )">
-        <CrossGenedDirectory>$(CrossGenOutputPath)/%(TargetPath)/</CrossGenedDirectory>
-        <CrossGenedPath>$(CrossGenOutputPath)/%(TargetPath)/%(FileName)%(Extension)</CrossGenedPath>
-        <CrossGenSymbolSemaphorePath>$(_crossGenIntermediatePath)/%(FileName).symbol.semaphore</CrossGenSymbolSemaphorePath>
+        <CrossGenedDirectory>$(CrossGenOutputPath)%(TargetPath)/</CrossGenedDirectory>
+        <CrossGenedPath>$(CrossGenOutputPath)%(TargetPath)/%(FileName)%(Extension)</CrossGenedPath>
+        <CrossGenSymbolSemaphorePath>$(_crossGenIntermediatePath)%(FileName).symbol.semaphore</CrossGenSymbolSemaphorePath>
       </_filesToCrossGen>
+    </ItemGroup>
 
+    <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' != ''">
       <FilesToPackage Remove="@(_filesToCrossGen)" />
-
-      <_crossGenedFilesToPackage Include="@(_filesToCrossGen->'%(CrossGenedPath)')" />
-      <FilesToPackage Include="@(_crossGenedFilesToPackage)" />
+      <FilesToPackage Include="@(_filesToCrossGen->'%(CrossGenedPath)')" />
     </ItemGroup>
   </Target>
 
   <Target Name="CrossGen"
           BeforeTargets="Build"
           DependsOnTargets="
-            GetCrossgenToolPaths;
-            EnsureCrossGenIsExecutable;
+            PrepareForCrossGen;
             CreateCrossGenImages;
             CreateCrossGenSymbols" />
 
   <Target Name="CreateCrossGenImages"
-          DependsOnTargets="PrepareForCrossGen"
+          Condition="'@(_filesToCrossGen)' != ''"
+          DependsOnTargets="
+            GetCrossgenToolPaths;
+            EnsureCrossGenIsExecutable"
           Inputs="@(_filesToCrossGen)"
           Outputs="%(_filesToCrossGen.CrossGenedPath)">
     <PropertyGroup>
-      <_crossGenResponseFile>$(_crossGenIntermediatePath)/%(_filesToCrossGen.FileName).rsp</_crossGenResponseFile>
+      <_crossGenResponseFile>$(_crossGenIntermediatePath)%(_filesToCrossGen.FileName).rsp</_crossGenResponseFile>
     </PropertyGroup>
     <ItemGroup>
       <_crossGenArgs Include="-readytorun" />
     <MakeDir Directories="$([System.IO.Path]::GetDirectoryName('%(_filesToCrossGen.CrossGenedPath)'))" />
     <WriteLinesToFile File="$(_crossGenResponseFile)" Lines="@(_crossGenArgs)" Overwrite="true" />
 
+    <!--
+      Use IgnoreStandardErrorWarningFormat because Arcade sets WarnAsError and in some cases
+      crossgen warnings need to be ignored, like https://github.com/dotnet/core-setup/issues/5940.
+    -->
     <Exec
       Command="$(_crossGenPath) @$(_crossGenResponseFile)"
       WorkingDirectory="$(_clrDirectory)"
-      EnvironmentVariables="COMPlus_PartialNGen=$(_partialCrossgenFlag)" />
+      EnvironmentVariables="COMPlus_PartialNGen=$(_partialCrossgenFlag)"
+      IgnoreStandardErrorWarningFormat="true" />
   </Target>
 
   <Target Name="CreateCrossGenSymbols"
           Inputs="%(_filesToCrossGen.CrossGenedPath)"
           Outputs="%(_filesToCrossGen.CrossGenSymbolSemaphorePath)">
     <PropertyGroup>
-      <_crossGenSymbolsResponseFile>$(_crossGenIntermediatePath)/%(_filesToCrossGen.FileName).symbols.rsp</_crossGenSymbolsResponseFile>
+      <_crossGenSymbolsResponseFile>$(_crossGenIntermediatePath)%(_filesToCrossGen.FileName).symbols.rsp</_crossGenSymbolsResponseFile>
       <_crossGenSymbolsOptionName Condition="'$(OS)' == 'Windows_NT'">CreatePDB</_crossGenSymbolsOptionName>
       <_crossGenSymbolsOptionName Condition="'$(_crossGenSymbolsOptionName)' == ''">CreatePerfMap</_crossGenSymbolsOptionName>
       <_crossGenSymbolsOutputDirectory>$(CrossGenSymbolsOutputPath)/%(_filesToCrossGen.TargetPath)</_crossGenSymbolsOutputDirectory>
     <ItemGroup>
       <FilesToPackage Include="$(CrossGenSymbolsOutputPath)/**/*$(CrossGenSymbolExtension)">
         <IsSymbolFile>true</IsSymbolFile>
-        <TargetPath>runtimes/$(NuGetRuntimeIdentifier)/lib/$(PackageTargetFramework)</TargetPath>
+        <TargetPath>runtimes/$(PackageRID)/lib/$(PackageTargetFramework)</TargetPath>
       </FilesToPackage>
     </ItemGroup>
   </Target>
           DependsOnTargets="PrepareForCrossGen;GetCrossGenSymbolsFiles" />
 
   <Target Name="GetReferenceFilenames"
-          Returns="@(Reference -> '%(Filename)')"
-          DependsOnTargets="ResolveNuGetPackages" />
+          DependsOnTargets="ResolveReferences"
+          Returns="@(Reference -> '%(Filename)')" />
 
   <!-- Target overrides (can't be shared with pkgproj) -->
 
index dc77e8d..c7f1ea1 100644 (file)
@@ -3,285 +3,6 @@
     Shared targets specific to projects building 'Microsoft.*.App*' packages.
   -->
 
-  <UsingTask TaskName="BuildFPMToolPreReqs" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
-  <UsingTask TaskName="GenerateJsonObjectString" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
-
-  <Import Project="$(MSBuildThisFileDirectory)windows/wix.targets" />
-
-  <Target Name="GenerateInstallers"
-          DependsOnTargets="
-            GetInstallerProperties;
-            GenerateDeb;
-            GenerateRpm;
-            GenerateMsi;
-            GeneratePkg;
-            GenerateCompressedArchive" />
-
-  <Target Name="GenerateDeb" DependsOnTargets="TestDebuild;CreateDeb" Condition="'$(BuildDebPackage)' == 'true'"/>
-  <Target Name="GenerateRpm" DependsOnTargets="TestFPMTool;CreateRpm" Condition="'$(BuildRpmPackage)' == 'true'"/>
-  <Target Name="GenerateMsi" DependsOnTargets="CreateMsi" Condition="'$(GenerateMSI)' == 'true'"/>
-  <Target Name="GeneratePkg" DependsOnTargets="CreatePkg" Condition="'$(GeneratePkg)' == 'true'"/>
-  <Target Name="GenerateCompressedArchive" DependsOnTargets="CreateCompressedArchive" Condition="'$(GenerateCompressedArchive)' == 'true'"/>
-
-  <!--
-    Create Debian package.
-  -->
-  <Target Name="CreateDeb"
-          DependsOnTargets="
-            GetInstallerProperties;
-            InitializeDotnetDebTool;
-            CreateInstallerLayout;
-            GetDebInstallerJsonProperties"
-          Condition="'$(DebuildPresent)' == 'true'">
-    <PropertyGroup>
-      <ConfigJsonFile>$(LayoutDirectory)debian_config.json</ConfigJsonFile>
-      <DebIntermediatesDir>$(InstallerIntermediatesDir)out-deb</DebIntermediatesDir>
-
-      <DebToolArgs>-i $(LayoutDirectory)</DebToolArgs>
-      <DebToolArgs>$(DebToolArgs) -o $(DebIntermediatesDir)</DebToolArgs>
-      <DebToolArgs>$(DebToolArgs) -n $(VersionedInstallerName)</DebToolArgs>
-      <DebToolArgs>$(DebToolArgs) -v $(InstallerPackageVersion)</DebToolArgs>
-    </PropertyGroup>
-
-    <!-- Write the configuration JSON. -->
-    <GenerateJsonObjectString
-      Properties="@(CommonJsonProperty);@(DebJsonProperty)"
-      TargetFile="$(ConfigJsonFile)" />
-
-    <!-- Run deb tool in the directory of the consumer project. -->
-    <Exec
-      Command="$(DotnetToolCommand) deb-tool $(DebToolArgs)"
-      WorkingDirectory="$(DebtoolConsumerDeployDir)" />
-
-    <!-- Copy package to output. -->
-    <ItemGroup>
-      <GeneratedDebFiles Include="$(DebIntermediatesDir)/*.deb" />
-    </ItemGroup>
-
-    <Error Text="@(GeneratedDebFiles->Count()) .deb files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
-
-    <Copy SourceFiles="@(GeneratedDebFiles)"
-          DestinationFiles="$(InstallerFile)"
-          OverwriteReadOnlyFiles="True"
-          SkipUnchangedFiles="False"
-          UseHardlinksIfPossible="False" />
-  </Target>
-
-  <Target Name="GetDebInstallerJsonProperties"
-          DependsOnTargets="GetCommonJsonProperties">
-    <ItemGroup>
-      <DebJsonProperty Include="debian_dependencies" Object="{}" />
-    </ItemGroup>
-  </Target>
-
-  <!--
-    Create RPM package.
-  -->
-  <Target Name="CreateRpm"
-          DependsOnTargets="
-            GetInstallerProperties;
-            CreateInstallerLayout;
-            GetRpmInstallerJsonProperties"
-          Condition="'$(FPMPresent)' == 'true'">
-    <PropertyGroup>
-      <ConfigJsonFile>$(LayoutDirectory)rpm_config.json</ConfigJsonFile>
-      <RpmIntermediatesDir>$(InstallerIntermediatesDir)out-rpm</RpmIntermediatesDir>
-
-      <!-- Copyright, Changelog -->
-      <RpmTemplatesLayoutDir>$(LayoutDirectory)templates/</RpmTemplatesLayoutDir>
-    </PropertyGroup>
-
-    <ItemGroup>
-      <RpmTemplateFile Include="$(RpmTemplatesDir)**/*" />
-    </ItemGroup>
-
-    <Copy
-      SourceFiles="@(RpmTemplateFile)"
-      DestinationFiles="@(RpmTemplateFile->'$(RpmTemplatesLayoutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
-
-    <GenerateJsonObjectString
-      Properties="@(CommonJsonProperty);@(RpmJsonProperty)"
-      TargetFile="$(ConfigJsonFile)" />
-
-    <MakeDir Directories="$(RpmIntermediatesDir)" />
-
-    <!-- Call the task to build the pre-reqs (parameters, copyright, changelog) for calling the FPM tool -->
-    <BuildFPMToolPreReqs
-      InputDir="$(LayoutDirectory)"
-      OutputDir="$(RpmIntermediatesDir)"
-      PackageVersion="$(InstallerPackageVersion)"
-      ConfigJsonFile="$(ConfigJsonFile)">
-      <Output TaskParameter="FPMParameters" PropertyName="FPMCmdParameters" />
-    </BuildFPMToolPreReqs>
-
-    <Exec Command="fpm $(FPMCmdParameters)" WorkingDirectory="$(RpmIntermediatesDir)" />
-
-    <!-- Copy package to output -->
-    <ItemGroup>
-      <GeneratedRpmFiles Include="$(RpmIntermediatesDir)/*.rpm" />
-    </ItemGroup>
-
-    <Error Text="@(GeneratedRpmFiles->Count()) .rpm files generated." Condition="'@(GeneratedRpmFiles->Count())' != 1" />
-
-    <Copy SourceFiles="@(GeneratedRpmFiles)"
-          DestinationFiles="$(InstallerFile)"
-          OverwriteReadOnlyFiles="True"
-          SkipUnchangedFiles="False"
-          UseHardlinksIfPossible="False" />
-  </Target>
-
-  <Target Name="GetRpmInstallerJsonProperties"
-          DependsOnTargets="GetCommonJsonProperties">
-    <ItemGroup>
-      <RpmJsonProperty Include="vendor" String=".NET Foundation" />
-      <RpmJsonProperty Include="install_doc" String="/usr/share/doc/$(VersionedInstallerName)/" />
-      <RpmJsonProperty Include="rpm_dependencies" Object="{}" />
-    </ItemGroup>
-  </Target>
-
-  <!--
-    Create MSI installer, using WiX tools.
-  -->
-  <Target Name="CreateMsi"
-          DependsOnTargets="
-            GetInstallerProperties;
-            RunLightLinker">
-    <Message Text="Created '$(InstallerFile)'" Importance="High" />
-  </Target>
-
-  <Target Name="CreateCompressedArchive"
-          DependsOnTargets="
-            GetInstallerProperties;
-            GenerateZip"/>
-
-  <UsingTask TaskName="ZipFileCreateFromDirectory" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
-
-  <Target Name="GenerateZip"
-          Condition="'$(OSGroup)' == 'Windows_NT'">
-    <ZipFileCreateFromDirectory
-      SourceDirectory="$(SharedFrameworkArchiveSourceDir)"
-      DestinationArchive="$(CompressedArchiveFile)"
-      OverwriteDestination="true" />
-  </Target>
-
-  <!--
-    Create macOS pkg installer.
-  -->
-  <Target Name="CreatePkg"
-          DependsOnTargets="
-            GetInstallerProperties;
-            FixLayoutPermissions">
-    <PropertyGroup>
-      <_pkgArgs></_pkgArgs>
-      <_pkgArgs>$(_pkgArgs) --root $(PackLayoutDir)</_pkgArgs>
-      <_pkgArgs>$(_pkgArgs) --identifier $(MacOSComponentName)</_pkgArgs>
-      <_pkgArgs>$(_pkgArgs) --version $(ProductVersion)</_pkgArgs>
-      <_pkgArgs>$(_pkgArgs) --install-location $(MacOSSharedInstallDir)</_pkgArgs>
-      <_pkgArgs>$(_pkgArgs) $(InstallerFile)</_pkgArgs>
-    </PropertyGroup>
-
-    <Exec Command="pkgbuild $(_pkgArgs)" />
-  </Target>
-
-  <!--
-    Create installer layout. Used for RPM or Debian package creation.
-  -->
-  <Target Name="CreateInstallerLayout"
-          DependsOnTargets="
-            FixLayoutPermissions;
-            CopyFilesToLayout" />
-
-  <Target Name="CopyFilesToLayout">
-    <PropertyGroup>
-      <LayoutDirectory>$(InstallerIntermediatesDir)/layoutDirectory/</LayoutDirectory>
-      <LayoutAbsolute>$(LayoutDirectory)$</LayoutAbsolute>
-      <LayoutPackageRoot>$(LayoutDirectory)package_root</LayoutPackageRoot>
-      <LayoutSamples>$(LayoutDirectory)samples</LayoutSamples>
-      <LayoutDocs>$(LayoutDirectory)docs</LayoutDocs>
-    </PropertyGroup>
-
-    <RemoveDir Condition="Exists('$(InstallerIntermediatesDir)')" Directories="$(InstallerIntermediatesDir)" />
-    <MakeDir Directories="$(InstallerIntermediatesDir)" />
-
-    <!-- Create empty layout. -->
-    <RemoveDir Condition="Exists('$(LayoutDirectory)')" Directories="$(LayoutDirectory)" />
-    <MakeDir Directories="$(LayoutDirectory)" />
-    <MakeDir Directories="$(LayoutAbsolute)" />
-    <MakeDir Directories="$(LayoutPackageRoot)" />
-    <MakeDir Directories="$(LayoutSamples)" />
-    <MakeDir Directories="$(LayoutDocs)" />
-
-    <!-- Copy files to layout. -->
-    <ItemGroup>
-      <LayoutFiles Include="$(PackLayoutDir)/**/*" />
-    </ItemGroup>
-
-    <Error Text="No pack layout files found, expected > 0." Condition="@(LayoutFiles->Count()) == 0" />
-
-    <Copy
-      SourceFiles="@(LayoutFiles)"
-      DestinationFiles="@(LayoutFiles->'$(LayoutPackageRoot)/%(RecursiveDir)%(Filename)%(Extension)')" />
-  </Target>
-
-  <Target Name="FixLayoutPermissions"
-          Condition="'$(OSGroup)' != 'Windows_NT'">
-    <!-- Fix file permissions in the layout dir. -->
-    <!-- Reset everything to user readable/writeable and group and world readable. -->
-    <Exec Command='find "$(PackLayoutDir)" -type f -name "*" -exec chmod 644 {} \;' />
-    <!-- Generally, dylibs and sos have 'x'. -->
-    <Exec Command='find "$(PackLayoutDir)" -type f -name "*.dylib" -exec chmod 755 {} \;' />
-    <Exec Command='find "$(PackLayoutDir)" -type f -name "*.so" -exec chmod 755 {} \;' />
-    <!-- Executables (those without dots) are executable. -->
-    <Exec Command='find "$(PackLayoutDir)" -type f ! -name "*.*" -exec chmod 755 {} \;' />
-  </Target>
-
-  <!--
-    Get common JSON properties. Used in the configuration JSON for both RPM and Debian packages.
-  -->
-  <Target Name="GetCommonJsonProperties">
-    <PropertyGroup>
-      <FullLicenseText>$([System.IO.File]::ReadAllText('$(ProjectDir)LICENSE.TXT').Replace('%0A', '\n').Replace('"', '\"'))</FullLicenseText>
-    </PropertyGroup>
-
-    <ItemGroup>
-      <JsonReleaseProperty Include="package_version" String="1.0.0.0" />
-      <JsonReleaseProperty Include="package_revision" String="$(InstallerPackageRelease)" />
-      <JsonReleaseProperty Include="urgency" String="low" />
-      <JsonReleaseProperty Include="changelog_message" String="https://github.com/dotnet/core/tree/master/release-notes" />
-
-      <JsonControlProperty Include="priority" String="standard" />
-      <JsonControlProperty Include="section" String="libs" />
-      <JsonControlProperty Include="architecture" String="amd64" />
-
-      <JsonLicenseProperty Include="type" String="MIT and ASL 2.0 and BSD" />
-      <JsonLicenseProperty Include="full_text" String="$(FullLicenseText)" />
-    </ItemGroup>
-
-    <GenerateJsonObjectString Properties="@(JsonReleaseProperty)">
-      <Output TaskParameter="Json" PropertyName="JsonReleaseObject" />
-    </GenerateJsonObjectString>
-    <GenerateJsonObjectString Properties="@(JsonControlProperty)">
-      <Output TaskParameter="Json" PropertyName="JsonControlObject" />
-    </GenerateJsonObjectString>
-    <GenerateJsonObjectString Properties="@(JsonLicenseProperty)">
-      <Output TaskParameter="Json" PropertyName="JsonLicenseObject" />
-    </GenerateJsonObjectString>
-
-    <ItemGroup>
-      <CommonJsonProperty Include="package_name" String="$(VersionedInstallerName)" />
-      <CommonJsonProperty Include="short_description" String="$(MSBuildProjectName) $(InstallerPackageVersion)" />
-      <CommonJsonProperty Include="maintainer_name" String=".NET Core Team" />
-      <CommonJsonProperty Include="maintainer_email" String="dotnetpackages@dotnetfoundation.org" />
-      <CommonJsonProperty Include="install_root" String="/usr/share/dotnet" />
-      <CommonJsonProperty Include="long_description" String=".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs." />
-      <CommonJsonProperty Include="homepage" String="https://github.com/dotnet/core" />
-      <CommonJsonProperty Include="copyright" String="2017 Microsoft" />
-      <CommonJsonProperty Include="release" Object="$(JsonReleaseObject)" />
-      <CommonJsonProperty Include="control" Object="$(JsonControlObject)" />
-      <CommonJsonProperty Include="license" Object="$(JsonLicenseObject)" />
-    </ItemGroup>
-  </Target>
-
   <!--
     Copy the files in the package's data/ dir to a layout directory. This is what the pack installer
     will place in the dotnet install dir.
       Include="@(FrameworkPackDataEntries)" />
   </Target>
 
-  <Target Name="GenerateSharedFramework"
-          Condition="'$(GenerateSharedFramework)' == 'true'">
-    <PropertyGroup>
-      <!--
-        For the sfx intermediate path, use 'bin/obj/sfx/', without OSPlatformConfig (RID +
-        Release/Debug). This is to save on path chars, which are at a premium. if the Git clone root
-        is even a little deep, Windows max path is a big problem. Package caches are a particular
-        problem due to long IDs, long versions, and deep resource DLLs with big names.
-
-        The OSPlatformConfig is normally in the intermediate path because it allows building
-        different configurations without cleaning the repo in between. This can be valuable for dev
-        builds. Not including OSPlatformConfig is ok in this target because the intermediate dir is
-        always deleted before it's used.
-      -->
-      <SharedFrameworkIntermediateOutputPath>$(BaseIntermediateOutputPath)sfx/$(ShortFrameworkName)/</SharedFrameworkIntermediateOutputPath>
-    </PropertyGroup>
-
-    <!-- Delete layout directory and sfx NuGet cache to ensure freshness. -->
-    <RemoveDir Directories="$(SharedFrameworkLayoutDir);$(SharedFrameworkIntermediateOutputPath)" />
-
-    <!--
-      Build a csproj that lays out the shared framework using the SDK publish targets. Pass
-      properties to make the csproj restore and publish specific to the current pkgproj.
-
-      Noteworthy inputs:
-        SharedFrameworkName:
-          Name of the shared framework, such as Microsoft.NETCore.App.
-        SharedFrameworkPkgprojFile:
-          Full path of the pkgproj that produces the framework package. The framework package
-          identity is extracted from here via an MSBuild task, to be restored.
-        SharedFrameworkLayoutDir:
-          Directory to lay out "<id>/<version>/<files>" of the shared fx.
-        IntermediateOutputPath:
-          Typical: directory for intermediates, custom to avoid clashing.
-        MSBuildProjectExtensionsPath:
-          Same as IntermediateOutputPath. Passed in as a workaround, because the SDK needs the value
-          in its props file before we have a chance to override in this project.
-    -->
-    <MSBuild
-      Projects="$(MSBuildThisFileDirectory)sharedFramework/sharedFramework.csproj"
-      Properties="
-        SharedFrameworkName=$(MSBuildProjectName);
-        SharedFrameworkPkgprojFile=$(MSBuildProjectFullPath);
-        SharedFrameworkLayoutDir=$(SharedFrameworkLayoutDir);
-        IntermediateOutputPath=$(SharedFrameworkIntermediateOutputPath);
-        MSBuildProjectExtensionsPath=$(SharedFrameworkIntermediateOutputPath);
-        PackageRID=$(PackageRID);
-        GenerateNetCoreAppRuntimeConfig=$(GenerateNetCoreAppRuntimeConfig);
-        GenerateRuntimeGraph=$(GenerateRuntimeGraph)" />
-  </Target>
-
   <!--
     Add note to Targeting Pack nupkg description that this package shouldn't be referenced directly.
     The packaging tooling normally only adds this to runtime packages.
 
   <!-- Target overrides (can't be shared with other package projects) -->
 
+  <!--
+    Redefine build. The packaging tools require a parameterized build call to use IDs other than the
+    project name such as the runtime pack RID suffix and runtime package RID prefix. Perform a
+    nested build when these runtime-specific packages are necessary.
+
+    Also, generate shared framework layout and installers as appropriate.
+  -->
+  <Target Name="Build"
+          DependsOnTargets="
+            BuildRidAgnosticPackage;
+            BuildRidSpecificPackage;
+            GenerateInstallers" />
+
+  <Target Name="BuildRidAgnosticPackage"
+          DependsOnTargets="$(BuildDependsOn)"
+          Condition="'$(BuildLineupPackage)' == 'true'">
+    <Message Text="$(MSBuildProjectName) -> $(NuSpecPath)" Importance="high" />
+  </Target>
+
+  <Target Name="BuildRidSpecificPackage">
+    <!--
+      If PackageRID should be built for the current package, PackageBuildRID is set to PackageRID.
+      Otherwise, PackageBuildRID is left empty.
+    -->
+    <PropertyGroup>
+      <PackageBuildRID Condition="'%(Identity)' == '$(PackageRID)'">@(BuildRID)</PackageBuildRID>
+    </PropertyGroup>
+
+    <PropertyGroup Condition="'$(BuildRidSpecificPacks)' == 'true'">
+      <RidSpecificPackProperties>BaseId=$(MSBuildProjectName).$(PackageBuildRID);IdPrefix=</RidSpecificPackProperties>
+    </PropertyGroup>
+
+    <!--
+      Ensure all project references are built to make sure dependencies (e.g. native build and
+      depproj's crossgen) runs first. The global properties mean we can't let the inner build handle
+      this itself because it would miss the cache of finished builds.
+    -->
+    <MSBuild
+      Projects="@(ProjectReference);@(WaitOnlyProjectReference)"
+      Targets="Build" />
+
+    <MSBuild
+      Condition="
+        '$(PackageBuildRID)' != '' and
+        (
+          '$(BuildRidSpecificPacks)' == 'true' or
+          ('$(FrameworkPackType)' == '' and '$(BuildRuntimePackages)' == 'true')
+        )"
+      Projects="$(MSBuildProjectFullPath)"
+      Targets="InnerBuildRidSpecificPackage"
+      Properties="
+        BuildPackageLibraryReferences=false;
+        DisableOrderDependencies=true;
+        PackageTargetRuntime=$(PackageBuildRID);
+        NuGetRuntimeIdentifier=$(PackageBuildRID);
+        $(RidSpecificPackProperties)" />
+  </Target>
+
+  <Target Name="InnerBuildRidSpecificPackage"
+          DependsOnTargets="$(BuildDependsOn)">
+    <Message Text="$(MSBuildProjectName) -> $(NuSpecPath)" Importance="high" />
+  </Target>
+
   <Import
     Project="$(MSBuildThisFileDirectory)skip.GetPackageReport.targets"
     Condition="'$(SkipValidatePackage)' == 'true'"/>
diff --git a/src/installer/pkg/packaging-tools/installer.targets b/src/installer/pkg/packaging-tools/installer.targets
new file mode 100644 (file)
index 0000000..245f964
--- /dev/null
@@ -0,0 +1,286 @@
+<Project>
+  <!--
+    Shared targets to build installer artifacts such as installers, distro packages, and tarballs.
+  -->
+
+  <UsingTask TaskName="BuildFPMToolPreReqs" AssemblyFile="$(LocalBuildToolsTaskFile)"/>
+  <UsingTask TaskName="GenerateJsonObjectString" AssemblyFile="$(LocalBuildToolsTaskFile)"/>
+  <UsingTask TaskName="ZipFileCreateFromDirectory" AssemblyFile="$(LocalBuildToolsTaskFile)"/>
+  <UsingTask TaskName="ZipFileExtractToDirectory" AssemblyFile="$(LocalBuildToolsTaskFile)" />
+  <UsingTask TaskName="ZipFileGetEntries" AssemblyFile="$(LocalBuildToolsTaskFile)" />
+
+  <Import Project="$(MSBuildThisFileDirectory)windows/wix.targets" />
+
+  <Target Name="GenerateInstallers"
+          DependsOnTargets="
+            GetInstallerProperties;
+            GenerateDeb;
+            GenerateRpm;
+            GenerateMsi;
+            GeneratePkg;
+            GenerateCompressedArchive" />
+
+  <Target Name="GenerateDeb" DependsOnTargets="TestDebuild;CreateDeb" Condition="'$(BuildDebPackage)' == 'true'"/>
+  <Target Name="GenerateRpm" DependsOnTargets="TestFPMTool;CreateRpm" Condition="'$(BuildRpmPackage)' == 'true'"/>
+  <Target Name="GenerateMsi" DependsOnTargets="CreateMsi" Condition="'$(GenerateMSI)' == 'true'"/>
+  <Target Name="GeneratePkg" DependsOnTargets="CreatePkg" Condition="'$(GeneratePkg)' == 'true'"/>
+  <Target Name="GenerateCompressedArchive" DependsOnTargets="CreateCompressedArchive" Condition="'$(GenerateCompressedArchive)' == 'true'"/>
+
+  <!--
+    Create Debian package.
+  -->
+  <Target Name="CreateDeb"
+          DependsOnTargets="
+            GetInstallerProperties;
+            InitializeDotnetDebTool;
+            CreateInstallerLayout;
+            GetDebInstallerJsonProperties"
+          Condition="'$(DebuildPresent)' == 'true'">
+    <PropertyGroup>
+      <ConfigJsonFile>$(LayoutDirectory)debian_config.json</ConfigJsonFile>
+      <DebIntermediatesDir>$(InstallerIntermediatesDir)out-deb</DebIntermediatesDir>
+
+      <DebToolArgs>-i $(LayoutDirectory)</DebToolArgs>
+      <DebToolArgs>$(DebToolArgs) -o $(DebIntermediatesDir)</DebToolArgs>
+      <DebToolArgs>$(DebToolArgs) -n $(VersionedInstallerName)</DebToolArgs>
+      <DebToolArgs>$(DebToolArgs) -v $(InstallerPackageVersion)</DebToolArgs>
+    </PropertyGroup>
+
+    <!-- Write the configuration JSON. -->
+    <GenerateJsonObjectString
+      Properties="@(CommonJsonProperty);@(DebJsonProperty)"
+      TargetFile="$(ConfigJsonFile)" />
+
+    <!-- Run deb tool in the directory of the consumer project. -->
+    <Exec
+      Command="$(DotNetTool) deb-tool $(DebToolArgs)"
+      WorkingDirectory="$(DebtoolConsumerDeployDir)" />
+
+    <!-- Copy package to output. -->
+    <ItemGroup>
+      <GeneratedDebFiles Include="$(DebIntermediatesDir)/*.deb" />
+    </ItemGroup>
+
+    <Error Text="@(GeneratedDebFiles->Count()) .deb files generated." Condition="'@(GeneratedDebFiles->Count())' != 1" />
+
+    <Copy SourceFiles="@(GeneratedDebFiles)"
+          DestinationFiles="$(InstallerFile)"
+          OverwriteReadOnlyFiles="True"
+          SkipUnchangedFiles="False"
+          UseHardlinksIfPossible="False" />
+  </Target>
+
+  <Target Name="GetDebInstallerJsonProperties"
+          DependsOnTargets="GetCommonJsonProperties">
+    <ItemGroup>
+      <DebJsonProperty Include="debian_dependencies" Object="{}" />
+    </ItemGroup>
+  </Target>
+
+  <!--
+    Create RPM package.
+  -->
+  <Target Name="CreateRpm"
+          DependsOnTargets="
+            GetInstallerProperties;
+            CreateInstallerLayout;
+            GetRpmInstallerJsonProperties"
+          Condition="'$(FPMPresent)' == 'true'">
+    <PropertyGroup>
+      <ConfigJsonFile>$(LayoutDirectory)rpm_config.json</ConfigJsonFile>
+      <RpmIntermediatesDir>$(InstallerIntermediatesDir)out-rpm</RpmIntermediatesDir>
+
+      <!-- Copyright, Changelog -->
+      <RpmTemplatesLayoutDir>$(LayoutDirectory)templates/</RpmTemplatesLayoutDir>
+    </PropertyGroup>
+
+    <ItemGroup>
+      <RpmTemplateFile Include="$(RpmTemplatesDir)**/*" />
+    </ItemGroup>
+
+    <Copy
+      SourceFiles="@(RpmTemplateFile)"
+      DestinationFiles="@(RpmTemplateFile->'$(RpmTemplatesLayoutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
+
+    <GenerateJsonObjectString
+      Properties="@(CommonJsonProperty);@(RpmJsonProperty)"
+      TargetFile="$(ConfigJsonFile)" />
+
+    <MakeDir Directories="$(RpmIntermediatesDir)" />
+
+    <!-- Call the task to build the pre-reqs (parameters, copyright, changelog) for calling the FPM tool -->
+    <BuildFPMToolPreReqs
+      InputDir="$(LayoutDirectory)"
+      OutputDir="$(RpmIntermediatesDir)"
+      PackageVersion="$(InstallerPackageVersion)"
+      ConfigJsonFile="$(ConfigJsonFile)">
+      <Output TaskParameter="FPMParameters" PropertyName="FPMCmdParameters" />
+    </BuildFPMToolPreReqs>
+
+    <Exec Command="fpm $(FPMCmdParameters)" WorkingDirectory="$(RpmIntermediatesDir)" />
+
+    <!-- Copy package to output -->
+    <ItemGroup>
+      <GeneratedRpmFiles Include="$(RpmIntermediatesDir)/*.rpm" />
+    </ItemGroup>
+
+    <Error Text="@(GeneratedRpmFiles->Count()) .rpm files generated." Condition="'@(GeneratedRpmFiles->Count())' != 1" />
+
+    <Copy SourceFiles="@(GeneratedRpmFiles)"
+          DestinationFiles="$(InstallerFile)"
+          OverwriteReadOnlyFiles="True"
+          SkipUnchangedFiles="False"
+          UseHardlinksIfPossible="False" />
+  </Target>
+
+  <Target Name="GetRpmInstallerJsonProperties"
+          DependsOnTargets="GetCommonJsonProperties">
+    <ItemGroup>
+      <RpmJsonProperty Include="vendor" String=".NET Foundation" />
+      <RpmJsonProperty Include="install_doc" String="/usr/share/doc/$(VersionedInstallerName)/" />
+      <RpmJsonProperty Include="rpm_dependencies" Object="{}" />
+    </ItemGroup>
+  </Target>
+
+  <!--
+    Create MSI installer, using WiX tools.
+  -->
+  <Target Name="CreateMsi"
+          DependsOnTargets="
+            GetInstallerProperties;
+            RunLightLinker">
+    <Message Text="Created '$(InstallerFile)'" Importance="High" />
+  </Target>
+
+  <Target Name="CreateCompressedArchive"
+          DependsOnTargets="
+            GetInstallerProperties;
+            GenerateZip"/>
+
+  <Target Name="GenerateZip"
+          Condition="'$(OSGroup)' == 'Windows_NT'">
+    <ZipFileCreateFromDirectory
+      SourceDirectory="$(SharedFrameworkArchiveSourceDir)"
+      DestinationArchive="$(CompressedArchiveFile)"
+      OverwriteDestination="true" />
+  </Target>
+
+  <!--
+    Create macOS pkg installer.
+  -->
+  <Target Name="CreatePkg"
+          DependsOnTargets="
+            GetInstallerProperties;
+            FixLayoutPermissions">
+    <PropertyGroup>
+      <_pkgArgs></_pkgArgs>
+      <_pkgArgs>$(_pkgArgs) --root $(PackLayoutDir)</_pkgArgs>
+      <_pkgArgs>$(_pkgArgs) --identifier $(MacOSComponentName)</_pkgArgs>
+      <_pkgArgs>$(_pkgArgs) --version $(ProductVersion)</_pkgArgs>
+      <_pkgArgs>$(_pkgArgs) --install-location $(MacOSSharedInstallDir)</_pkgArgs>
+      <_pkgArgs>$(_pkgArgs) $(InstallerFile)</_pkgArgs>
+    </PropertyGroup>
+
+    <Exec Command="pkgbuild $(_pkgArgs)" />
+  </Target>
+
+  <!--
+    Create installer layout. Used for RPM or Debian package creation.
+  -->
+  <Target Name="CreateInstallerLayout"
+          DependsOnTargets="
+            FixLayoutPermissions;
+            CopyFilesToLayout" />
+
+  <Target Name="CopyFilesToLayout">
+    <PropertyGroup>
+      <LayoutDirectory>$(InstallerIntermediatesDir)/layoutDirectory/</LayoutDirectory>
+      <LayoutAbsolute>$(LayoutDirectory)$</LayoutAbsolute>
+      <LayoutPackageRoot>$(LayoutDirectory)package_root</LayoutPackageRoot>
+      <LayoutSamples>$(LayoutDirectory)samples</LayoutSamples>
+      <LayoutDocs>$(LayoutDirectory)docs</LayoutDocs>
+    </PropertyGroup>
+
+    <RemoveDir Condition="Exists('$(InstallerIntermediatesDir)')" Directories="$(InstallerIntermediatesDir)" />
+    <MakeDir Directories="$(InstallerIntermediatesDir)" />
+
+    <!-- Create empty layout. -->
+    <RemoveDir Condition="Exists('$(LayoutDirectory)')" Directories="$(LayoutDirectory)" />
+    <MakeDir Directories="$(LayoutDirectory)" />
+    <MakeDir Directories="$(LayoutAbsolute)" />
+    <MakeDir Directories="$(LayoutPackageRoot)" />
+    <MakeDir Directories="$(LayoutSamples)" />
+    <MakeDir Directories="$(LayoutDocs)" />
+
+    <!-- Copy files to layout. -->
+    <ItemGroup>
+      <LayoutFiles Include="$(PackLayoutDir)/**/*" />
+    </ItemGroup>
+
+    <Error Text="No pack layout files found, expected > 0." Condition="@(LayoutFiles->Count()) == 0" />
+
+    <Copy
+      SourceFiles="@(LayoutFiles)"
+      DestinationFiles="@(LayoutFiles->'$(LayoutPackageRoot)/%(RecursiveDir)%(Filename)%(Extension)')" />
+  </Target>
+
+  <Target Name="FixLayoutPermissions"
+          Condition="'$(OSGroup)' != 'Windows_NT'">
+    <!-- Fix file permissions in the layout dir. -->
+    <!-- Reset everything to user readable/writeable and group and world readable. -->
+    <Exec Command='find "$(PackLayoutDir)" -type f -name "*" -exec chmod 644 {} \;' />
+    <!-- Generally, dylibs and sos have 'x'. -->
+    <Exec Command='find "$(PackLayoutDir)" -type f -name "*.dylib" -exec chmod 755 {} \;' />
+    <Exec Command='find "$(PackLayoutDir)" -type f -name "*.so" -exec chmod 755 {} \;' />
+    <!-- Executables (those without dots) are executable. -->
+    <Exec Command='find "$(PackLayoutDir)" -type f ! -name "*.*" -exec chmod 755 {} \;' />
+  </Target>
+
+  <!--
+    Get common JSON properties. Used in the configuration JSON for both RPM and Debian packages.
+  -->
+  <Target Name="GetCommonJsonProperties">
+    <PropertyGroup>
+      <FullLicenseText>$([System.IO.File]::ReadAllText('$(ProjectDir)LICENSE.TXT').Replace('%0A', '\n').Replace('"', '\"'))</FullLicenseText>
+    </PropertyGroup>
+
+    <ItemGroup>
+      <JsonReleaseProperty Include="package_version" String="1.0.0.0" />
+      <JsonReleaseProperty Include="package_revision" String="$(InstallerPackageRelease)" />
+      <JsonReleaseProperty Include="urgency" String="low" />
+      <JsonReleaseProperty Include="changelog_message" String="https://github.com/dotnet/core/tree/master/release-notes" />
+
+      <JsonControlProperty Include="priority" String="standard" />
+      <JsonControlProperty Include="section" String="libs" />
+      <JsonControlProperty Include="architecture" String="amd64" />
+
+      <JsonLicenseProperty Include="type" String="MIT and ASL 2.0 and BSD" />
+      <JsonLicenseProperty Include="full_text" String="$(FullLicenseText)" />
+    </ItemGroup>
+
+    <GenerateJsonObjectString Properties="@(JsonReleaseProperty)">
+      <Output TaskParameter="Json" PropertyName="JsonReleaseObject" />
+    </GenerateJsonObjectString>
+    <GenerateJsonObjectString Properties="@(JsonControlProperty)">
+      <Output TaskParameter="Json" PropertyName="JsonControlObject" />
+    </GenerateJsonObjectString>
+    <GenerateJsonObjectString Properties="@(JsonLicenseProperty)">
+      <Output TaskParameter="Json" PropertyName="JsonLicenseObject" />
+    </GenerateJsonObjectString>
+
+    <ItemGroup>
+      <CommonJsonProperty Include="package_name" String="$(VersionedInstallerName)" />
+      <CommonJsonProperty Include="short_description" String="$(MSBuildProjectName) $(InstallerPackageVersion)" />
+      <CommonJsonProperty Include="maintainer_name" String=".NET Core Team" />
+      <CommonJsonProperty Include="maintainer_email" String="dotnetpackages@dotnetfoundation.org" />
+      <CommonJsonProperty Include="install_root" String="/usr/share/dotnet" />
+      <CommonJsonProperty Include="long_description" String=".NET Core is a development platform that you can use to build command-line applications, microservices and modern websites. It is open source, cross-platform and is supported by Microsoft. We hope you enjoy using it! If you do, please consider joining the active community of developers that are contributing to the project on GitHub (https://github.com/dotnet/core). We happily accept issues and PRs." />
+      <CommonJsonProperty Include="homepage" String="https://github.com/dotnet/core" />
+      <CommonJsonProperty Include="copyright" String="2017 Microsoft" />
+      <CommonJsonProperty Include="release" Object="$(JsonReleaseObject)" />
+      <CommonJsonProperty Include="control" Object="$(JsonControlObject)" />
+      <CommonJsonProperty Include="license" Object="$(JsonLicenseObject)" />
+    </ItemGroup>
+  </Target>
+
+</Project>
index 178538a..233d7de 100644 (file)
@@ -1,7 +1,9 @@
 <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
   <PropertyGroup>
-    <InstallerSourceIntermediateOutputDir>$(BaseIntermediateOutputPath)$(InstallerSourceOSPlatformConfig)\$(MSBuildProjectName)\</InstallerSourceIntermediateOutputDir>
+    <InstallerSourceIntermediateOutputDir>$(ObjDir)$(InstallerSourceOSPlatformConfig)\$(MSBuildProjectName)\</InstallerSourceIntermediateOutputDir>
+
+    <CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
   </PropertyGroup>
 
   <!-- Detect framework pack suffix and apply defaults. -->
@@ -60,7 +62,7 @@
   </PropertyGroup>
 
   <PropertyGroup>
-    <SharedFrameworkLayoutDir>$(InstallerSourceIntermediateOutputDir)sharedFxLayout/</SharedFrameworkLayoutDir>
+    <SharedFrameworkLayoutDir Condition="'$(SharedFrameworkLayoutDir)' == ''">$(InstallerSourceIntermediateOutputDir)sharedFxLayout/</SharedFrameworkLayoutDir>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(IsFrameworkPackage)' == 'true'">
index 243bd08..5cf2496 100644 (file)
@@ -5,13 +5,22 @@
     overrides that shouldn't be applied to other projects.
   -->
   <Import Project="framework.dependency.targets" Condition="'$(MSBuildProjectExtension)' == '.depproj'" />
-  <Import Project="framework.packaging.targets" Condition="'$(IsFrameworkPackage)' == 'true'" />
+  <Import Project="framework.packaging.targets" Condition="'$(MSBuildProjectExtension)' == '.pkgproj'" />
+
+  <Import Project="installer.targets" />
+
+  <!-- Required by Common.Targets but not used by packaging projects. -->
+  <Target Name="CreateManifestResourceNames" />
+  <Target Name="CoreCompile" />
 
   <!--
     Set up properties for installer file. These depend on properties defined in the project file.
     (Unlike properties set up in packaging-tools.props, which shouldn't.)
   -->
-  <Target Name="GetInstallerProperties">
+  <Target Name="GetInstallerProperties"
+          DependsOnTargets="
+            GetInstallerBrandingNames;
+            GetProductVersions">
     <!-- Detect framework pack suffix and apply defaults. -->
     <PropertyGroup Condition="'$(FrameworkPackType)' == 'targeting'">
       <InstallerName>$(ShortFrameworkName)-targeting-pack</InstallerName>
       <GenerateMSI>false</GenerateMSI>
     </PropertyGroup>
 
+    <!-- Non-framework pkgproj shouldn't build MSIs. -->
+    <PropertyGroup Condition="'$(FrameworkPackType)' == '' and '$(MSBuildProjectExtension)' == '.pkgproj'">
+      <GenerateMSI>false</GenerateMSI>
+    </PropertyGroup>
+
     <PropertyGroup Condition="'$(GenerateSharedFramework)' == 'true'">
       <InstallerName>$(ShortFrameworkName)-runtime</InstallerName>
       <WixProductMoniker>$(SharedFrameworkBrandName)</WixProductMoniker>
diff --git a/src/installer/pkg/packaging-tools/sharedFramework/Directory.Build.props b/src/installer/pkg/packaging-tools/sharedFramework/Directory.Build.props
deleted file mode 100644 (file)
index 00bba61..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<Project>
-
-  <!--
-    This Directory.Build.props prevents the SDK from skipping down to the root
-    Directory.Build.props, following the Directory.Build.props chain instead.
-
-    Specifically, gets LibPrefix, LibSuffix, etc.
-  -->
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
-
-</Project>
index 3640e13..7521872 100644 (file)
   </Target>
 
   <!-- Set up information to pass to WiX, depending on the type of installer being created. -->
-  <Target Name="GetWixBuildConfiguration" DependsOnTargets="GetInstallerProperties">
+  <Target Name="GetWixBuildConfiguration"
+          DependsOnTargets="
+            AcquireWix;
+            GetInstallerProperties">
 
     <ItemGroup Condition="'$(FrameworkPackType)' != ''">
       <DirectoryToHarvest
index e28d126..d8ce1dd 100644 (file)
@@ -1,12 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\Directory.Build.props" />
+<Project>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" />
 
   <PropertyGroup>
     <PackagePlatform>AnyCPU</PackagePlatform>
-    <IntermediateOutputPath Condition="'$(IntermediateOutputPath)' == ''">obj/$(Configuration)/</IntermediateOutputPath>
-    <IntermediateOutputPath Condition="'$(NuGetRuntimeIdentifier)' != ''">$(IntermediateOutputPath)$(NuGetRuntimeIdentifier)/</IntermediateOutputPath>
-    
+
     <SkipPackageFileCheck>true</SkipPackageFileCheck>
     <!-- This property must be set to the same value as $(PackageOutputPath) for the nuspecs and nupkgs to be binplaced to the intended location. -->
     <OutputPath>$(PackageOutputPath)</OutputPath>
 
     <PackProjectDependencies>true</PackProjectDependencies>
 
-    <RestorePackages>true</RestorePackages>
-    <PrereleaseResolveNuGetPackages>true</PrereleaseResolveNuGetPackages>
+    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
+
+    <!-- Prevent unintended Microsoft.NETCore.Platforms package downgrade. -->
+    <DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
+    <ImportNuGetBuildTasksPackTargetsFromSdk>false</ImportNuGetBuildTasksPackTargetsFromSdk>
+
+    <!-- Tell NuGet where the assets file is. I think the intermediate output path got more complex with Arcade. -->
+    <RestoreOutputPath>$(BaseIntermediateOutputPath)</RestoreOutputPath>
+    <ProjectAssetsFile>$(RestoreOutputPath)\project.assets.json</ProjectAssetsFile>
+
+    <RestoreAllBuildRids>true</RestoreAllBuildRids>
   </PropertyGroup>
 
+  <!-- Most packages need the host to be built first. -->
+  <ItemGroup Condition="'$(DisableOrderDependencies)' != 'true'">
+    <ProjectReference Include="$(SourceDir)corehost\build.proj" />
+  </ItemGroup>
+
   <!-- In *.builds projects, the current phase's name is the same as the project name. -->
   <PropertyGroup>
     <BuildPhase>$(MSBuildProjectName)</BuildPhase>
@@ -40,7 +51,7 @@
   </PropertyGroup>
 
   <Choose>
-    <When Condition="$(PackageTargetRuntime.StartsWith('win'))">
+    <When Condition="$(PackageTargetRid.StartsWith('win'))">
       <PropertyGroup>
         <ApplicationFileExtension>.exe</ApplicationFileExtension>
         <LibraryFilePrefix></LibraryFilePrefix>
@@ -48,7 +59,7 @@
         <SymbolFileExtension>.pdb</SymbolFileExtension>
       </PropertyGroup>
     </When>
-    <When Condition="$(PackageTargetRuntime.StartsWith('osx'))">
+    <When Condition="$(PackageTargetRid.StartsWith('osx'))">
       <PropertyGroup>
         <ApplicationFileExtension></ApplicationFileExtension>
         <LibraryFilePrefix>lib</LibraryFilePrefix>
     <NuGetTargetMoniker>$(NETCoreAppFrameworkMoniker)</NuGetTargetMoniker>
     <NuGetTargetMonikerShort>$(NETCoreAppFramework)</NuGetTargetMonikerShort>
     <PackageTargetFramework>$(NETCoreAppFramework)</PackageTargetFramework>
-    <CrossGenOutputPath>$(CrossGenRootPath)/$(MSBuildProjectName)/$(NuGetRuntimeIdentifier)</CrossGenOutputPath>
+    <CrossGenOutputPath>$(CrossGenRootPath)$(MSBuildProjectName)\</CrossGenOutputPath>
     <ContainsPackageReferences>true</ContainsPackageReferences>
-    <!-- Disable restore normally: this is handled by ParallelSafeRestore. -->
-    <RestorePackages>false</RestorePackages>
     <RidSpecificAssets Condition="'$(NuGetRuntimeIdentifier)' != ''">true</RidSpecificAssets>
-    <IntermediateOutputPath>$(IntermediateOutputPath)$(NuGetRuntimeIdentifier)</IntermediateOutputPath>
-    <RestoreOutputPath>$(IntermediateOutputPath)</RestoreOutputPath>
-    <AdditionalRestoreArgs>/p:HasRuntimePackages=false /p:IntermediateOutputPath=$(IntermediateOutputPath) /bl:$(IntermediateOutputPath)/dotnet-restore.binlog</AdditionalRestoreArgs>
     <CrossGenSymbolsOutputPath>$(PackageSymbolsBinDir)/$(MSBuildProjectName)</CrossGenSymbolsOutputPath>
   </PropertyGroup>
 
+  <PropertyGroup>
+    <TargetFramework Condition="'$(TargetFramework)' == ''">$(PackageTargetFramework)</TargetFramework>
+    <TargetFramework Condition="'$(TargetFramework)' == ''">$(NETCoreAppFramework)</TargetFramework>
+  </PropertyGroup>
+
   <!-- Add required legal files to packages -->
   <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.pkgproj'">
     <File Condition="Exists('$(PackageLicenseFile)')"
       <ExcludeFromPlatformManifest>true</ExcludeFromPlatformManifest>
     </BuildRID>
     <BuildRID Include="@(_buildingOnRID)"/>
+
+    <RestoreBuildRID Include="@(BuildRID)" Exclude="@(UnofficialBuildRID)" />
   </ItemGroup>
 
   <PropertyGroup>
       AdditionalProperties="%(AdditionalProperties);BaseId=%(BaseId);IdPrefix=" />
   </ItemGroup>
 
-  <ItemGroup Condition="'$(PackageTargetRuntime)' == '' and '$(HasRuntimePackages)' != 'false'">
-    <ProjectReference Include="@(RuntimeProject)" />
-  </ItemGroup>
-  
+  <PropertyGroup>
+    <!-- During NuGet restore, grab assets for all applicable RIDs. -->
+    <RuntimeIdentifiers Condition="'$(RestoreAllBuildRids)' == 'true'">@(RestoreBuildRID)</RuntimeIdentifiers>
+    <!-- When resolving assets to pack, use the target runtime (if any). -->
+    <RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
+  </PropertyGroup>
+
 </Project>
\ No newline at end of file
index 0e210cc..f53a775 100644 (file)
@@ -1,10 +1,10 @@
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\Directory.Build.targets" />
+<Project>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.targets))\Directory.Build.targets" />
 
   <Import Project="$(PackagingToolsDir)packaging-tools.targets" />
 
-  <UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
-  <UsingTask TaskName="GenerateFileVersionProps" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
+  <UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(LocalBuildToolsTaskFile)"/>
+  <UsingTask TaskName="GenerateFileVersionProps" AssemblyFile="$(LocalBuildToolsTaskFile)"/>
 
   <PropertyGroup>
     <!--
   </PropertyGroup>
 
   <!--
-    Remove duplicate files returned by PrereleaseResolveNuGetPackageAssets. The resolve task
-    performs extra detection to pick up a PDB file for any file listed in the assets file. This
-    causes duplicates if the assets file lists PDBs. If foo.dll and foo.pdb exist in the package and
-    both are listed in the assets file, the task finds:
+    For any Dependency items with a VersionProp, set it to the property by that name given by the
+    version generation target.
+  -->
+  <Target Name="SetCustomPackageDependencyVersions"
+          BeforeTargets="GetPackageDependencies"
+          DependsOnTargets="GetProductVersions">
+    <ItemGroup>
+      <Dependency Version="$(%(Dependency.VersionProp))" Condition="'%(Dependency.VersionProp)' != ''" />
+    </ItemGroup>
+  </Target>
+
+  <!--
+    If the project is configured to use a shipped package version, set it. Use a target because we
+    need the versions from GetProductVersions.
+  -->
+  <Target Name="SetSpecificPackageVersion"
+          Condition="'$(VersionProp)' != ''"
+          BeforeTargets="GenerateNuSpec"
+          DependsOnTargets="GetProductVersions">
+    <!-- Use item metadata: $(%(foo)) works, $($(foo)) doesn't. -->
+    <ItemGroup>
+      <VersionPropItem Include="$(VersionProp)" />
+    </ItemGroup>
+    <PropertyGroup>
+      <Version>$(%(VersionPropItem.Identity))</Version>
+    </PropertyGroup>
+  </Target>
+
+  <!--
+    Remove duplicate files returned by restore. The resolve task performs extra detection to pick up
+    a PDB file for any file listed in the assets file. This causes duplicates if the assets file
+    lists PDBs. If foo.dll and foo.pdb exist in the package and both are listed in the assets file,
+    the task finds:
 
       foo.dll
       foo.pdb (based on foo.dll entry)
@@ -27,8 +56,7 @@
 
     The duplicates cause package validation failure and must be filtered out.
   -->
-  <Target Name="RemoveDuplicateResolvedNuGetPackageAssets"
-          AfterTargets="ResolveNuGetPackages">
+  <Target Name="RemoveDuplicateResolvedNuGetPackageAssets">
     <RemoveDuplicates Inputs="@(ReferenceCopyLocalPaths)">
       <Output TaskParameter="Filtered" ItemName="FilteredReferenceCopyLocalPaths"/>
     </RemoveDuplicates>
   </Target>
 
   <!--
-    Get Project items: build the project, and build runtime packages if necessary. All projects in
-    this directory are ProjectProviders.
+    Create RuntimeDependencies just before they're needed. Use MSBuild to get their identities, like
+    GetPkgProjPackageDependencies: this finds package id and version without any guesswork.
   -->
-  <Target Name="GetProjectsToBuild" Returns="@(Project)">
-    <ItemGroup>
-      <!-- The pkg and src builds both build these projects. Add them to both phases. -->
-      <PkgSrcProject Include="@(RuntimeProject)" Condition="'$(BuildRuntimePackages)' == 'true'" />
-      <PkgSrcProject Include="@(RidSpecificPackProject)" Condition="'$(BuildRidSpecificPacks)' == 'true'" />
-      <PkgSrcProject Include="$(MSBuildProjectFullPath)" Condition="'$(BuildLineupPackage)' == 'true'"/>
-
-      <Project Include="@(PkgSrcProject)" Phase="pkg" />
-      <Project Include="@(PkgSrcProject)" Phase="src" />
-
-      <!--
-        Create framework pack non-nuget packages/installers. Similar to the runtime package, we only
-        make one Debian or RPM package for all distros of that type.
-      -->
-      <Project
-        Include="$(MSBuildProjectFullPath)"
-        Phase="installer"
-        Condition="
-          '$(FrameworkPackType)' != '' AND
-          '$(BuildDistroIndependentInstallers)' == 'true'" />
-    </ItemGroup>
+  <Target Name="CreateRuntimeDependencyItems"
+          BeforeTargets="DetermineRuntimeDependencies"
+          Condition="'$(PackageTargetRuntime)' == '' and '$(HasRuntimePackages)' != 'false'">
+    <MSBuild
+      Targets="GetPackageIdentity"
+      BuildInParallel="$(BuildInParallel)"
+      Projects="@(RuntimeProject -> WithMetadataValue('Extension', '.pkgproj'))">
+      <Output TaskParameter="TargetOutputs" ItemName="_runtimeDependencyIdentity" />
+    </MSBuild>
 
-    <!-- Create shared framework and its installers. -->
-    <ItemGroup Condition="'$(GenerateSharedFramework)' == 'true' AND '$(BuildDistroIndependentInstallers)' == 'true'">
-      <Project Include="$(MSBuildProjectFullPath)" Phase="sharedfx" />
-      <!--
-        Currently any pkgproj is assumed to only build one type of installer, so there is no
-        distinction between this Project and a targeting pack installer Project. Some
-        AdditionalProperties may need to be added if this assumption doesn't hold up.
-      -->
-      <Project Include="$(MSBuildProjectFullPath)" Phase="installer" />
+    <ItemGroup>
+      <RuntimeDependency Include="@(_runtimeDependencyIdentity)" />
     </ItemGroup>
   </Target>
 
index 5be4c56..b66c807 100644 (file)
@@ -1,12 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <Version>$(AppHostVersion)</Version>
+    <VersionProp>AppHostVersion</VersionProp>
   </PropertyGroup>
 
   <Import Project="$(MSBuildProjectName).props" />
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
-</Project>
\ No newline at end of file
+</Project>
index 9d67e3d..90c7003 100644 (file)
@@ -1,12 +1,9 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <Version>$(HostVersion)</Version>
-  </PropertyGroup>    
+    <VersionProp>HostVersion</VersionProp>
+  </PropertyGroup>
 
   <Import Condition="'$(PackageTargetRuntime)' != ''" Project="$(MSBuildThisFileDirectory)runtime.$(OSGroup).$(MSBuildProjectName).props" />
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
index 79c8c0c..751acd3 100644 (file)
@@ -1,18 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <Version>$(HostPolicyVersion)</Version>
-  </PropertyGroup>   
+    <VersionProp>HostPolicyVersion</VersionProp>
+  </PropertyGroup>
 
   <ItemGroup>
-    <Dependency Include="Microsoft.NETCore.DotNetHostResolver">
-      <Version>$(HostResolverVersion)</Version>
-    </Dependency>
-  </ItemGroup>   
+    <Dependency Include="Microsoft.NETCore.DotNetHostResolver" VersionProp="HostResolverVersion" />
+  </ItemGroup>
 
   <Import Project="$(MSBuildProjectName).props" />
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
-</Project>
\ No newline at end of file
+</Project>
index 6eada90..3fb43c1 100644 (file)
@@ -1,18 +1,13 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <Version>$(HostResolverVersion)</Version>
-  </PropertyGroup>    
+    <VersionProp>HostResolverVersion</VersionProp>
+  </PropertyGroup>
 
   <ItemGroup>
-    <Dependency Include="Microsoft.NETCore.DotNetAppHost">
-      <Version>$(AppHostVersion)</Version>
-    </Dependency>
+    <Dependency Include="Microsoft.NETCore.DotNetAppHost" VersionProp="AppHostVersion" />
   </ItemGroup>
-     
+
   <Import Project="$(MSBuildProjectName).props" />
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
index a7b87d6..83c7b9b 100644 (file)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
   <PropertyGroup>
     <IsFrameworkPackage>true</IsFrameworkPackage>
     <ShortFrameworkName>dotnet</ShortFrameworkName>
index 285d435..01e75fa 100644 (file)
@@ -1,6 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <!--
     Create AppHost Pack based on legacy DotNetAppHost package. This can be collapsed once the legacy
@@ -8,5 +6,4 @@
   -->
   <Import Project="..\..\Microsoft.NETCore.DotNetAppHost\Microsoft.NETCore.DotNetAppHost.props" />
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
\ No newline at end of file
index c6311ed..35e3d84 100644 (file)
@@ -1,5 +1,2 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
+<Project Sdk="Microsoft.NET.Sdk">
 </Project>
index 1f6e95c..7e68f22 100644 (file)
@@ -1,6 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <!--
     Include HostPolicy and HostResolver based on legacy packages. This can be collapsed once the
@@ -9,5 +7,4 @@
   <Import Project="..\..\Microsoft.NETCore.DotNetHostPolicy\Microsoft.NETCore.DotNetHostPolicy.props" />
   <Import Project="..\..\Microsoft.NETCore.DotNetHostResolver\Microsoft.NETCore.DotNetHostResolver.props" />
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
index 0f3050a..3f59e87 100644 (file)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" />
 
   <PropertyGroup>
   <!-- Identity / Reference package content -->
   <ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
     <!-- reference RID specific packages to generate lineup -->
-    <ProjectReference Include="@(RuntimeProject)" />
+    <LineupProjectReference Include="@(RuntimeProject)" />
 
     <!-- references the host packages -->
-    <Dependency Include="Microsoft.NETCore.DotNetHostPolicy">
-       <Version>$(HostPolicyVersion)</Version>
-       <TargetFramework>$(NETCoreAppFramework)</TargetFramework>
-    </Dependency>
+    <Dependency
+      Include="Microsoft.NETCore.DotNetHostPolicy"
+      VersionProp="HostPolicyVersion"
+      TargetFramework="$(NETCoreAppFramework)" />
   </ItemGroup>
 
 </Project>
index 5c29a32..8a92a57 100644 (file)
@@ -1,12 +1,11 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
 
   <PropertyGroup>
     <!-- Make this Internal package's runtime.json point to the non-Internal runtime packages. -->
     <RuntimeProjectFile>$(MSBuildThisFileDirectory)Microsoft.NETCore.App.pkgproj</RuntimeProjectFile>
   </PropertyGroup>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
 
   <PropertyGroup>
     <!--
@@ -19,5 +18,5 @@
     <BuildRuntimePackages>false</BuildRuntimePackages>
   </PropertyGroup>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
+  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
 </Project>
index 908ad26..a797ecc 100644 (file)
@@ -1,6 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <!--
@@ -12,5 +10,4 @@
     <FrameworkListTargetPath>data/</FrameworkListTargetPath>
   </PropertyGroup>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
index 5981878..f3a57e7 100644 (file)
@@ -1,10 +1,10 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
+
   <PropertyGroup>
     <ExcludeDepprojReference>true</ExcludeDepprojReference>
   </PropertyGroup>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
 
   <PropertyGroup>
     <!-- Exclude runtime.json from the package. -->
     <ExcludeLineupReference>true</ExcludeLineupReference>
 
     <BuildRuntimePackages>false</BuildRuntimePackages>
-
-    <GenerateSharedFramework>true</GenerateSharedFramework>
-    <GenerateRuntimeGraph>true</GenerateRuntimeGraph>
-
-    <!--
-      Make sure the installer file is generated with the name from /Directory.Build.props. This allows the
-      existing infra to bundle it without any changes.
-    -->
-    <InstallerFile>$(SharedFrameworkInstallerFile)</InstallerFile>
-
-    <!-- Lay out the sfx in the legacy location for old packaging to keep working for now. -->
-    <SharedFrameworkLayoutDir>$(SharedFrameworkPublishDir)</SharedFrameworkLayoutDir>
-
-    <!-- These components are installed by the root shared framework, but not others. -->
-    <IncludeWerRelatedKeys>true</IncludeWerRelatedKeys>
-    <IncludeBreadcrumbStoreFolder>true</IncludeBreadcrumbStoreFolder>
   </PropertyGroup>
-  
+
   <ItemGroup>
     <Dependency Include="Microsoft.NETCore.Platforms" Version="$(MicrosoftNETCorePlatformsPackageVersion)" />
   </ItemGroup>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
-
-  <!--
-    Use the internal package to generate the shared framework. Allows the shared framework to
-    continue to have the correct name without other workarounds.
-  -->
-  <Target Name="GetSharedFrameworkPackageReferences"
-          Returns="@(SharedFrameworkPackageReference)">
-    <ItemGroup>
-      <SharedFrameworkPackageReference Include="Microsoft.NETCore.App.Internal" Version="$(Version)" />
-      <SharedFrameworkPackageReference Include="Microsoft.NETCore.DotNetHost" Version="$(HostVersion)" />
-    </ItemGroup>
-  </Target>
+  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
+
 </Project>
index f62fb97..b431402 100644 (file)
@@ -1,6 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <FrameworkPackageName>Microsoft.NETCore.App</FrameworkPackageName>
@@ -29,7 +27,7 @@
           Condition="'$(NuGetRuntimeIdentifier)' != ''"
           DependsOnTargets="GetCorePackagePaths" />
 
-  <Target Name="GetDependencyVersionFiles" DependsOnTargets="GetPackagePaths;ResolveNuGetPackages">
+  <Target Name="GetDependencyVersionFiles" DependsOnTargets="ResolveReferences;GetPackagePaths">
     <ItemGroup>
       <_coreFxVersionFile
         Include="$(PackagesDir)$([System.String]::new('%(Reference.NuGetPackageId)').ToLowerInvariant())/%(Reference.NuGetPackageVersion)/version.txt"
@@ -77,5 +75,4 @@
     </ItemGroup>
   </Target>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
index 0f867d0..7723580 100644 (file)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
   <PropertyGroup>
     <RIDPropsFile>$(MSBuildThisFileDirectory)netstandardRIDs.props</RIDPropsFile>
   </PropertyGroup>
index daf477a..bda0332 100644 (file)
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
   <PropertyGroup>
     <IsFrameworkPackage>true</IsFrameworkPackage>
     <ShortFrameworkName>netstandard</ShortFrameworkName>
index 1e5e478..7f6e543 100644 (file)
@@ -1,11 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <!-- .NET Standard has no shared framework, so there is no data for a platform manifest. -->
     <PlatformManifestTargetPath />
   </PropertyGroup>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
index 1e30b96..f5010bc 100644 (file)
@@ -1,6 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
     <NETStandardTargetFramework>netstandard2.1</NETStandardTargetFramework>
@@ -24,5 +22,4 @@
     </ItemGroup>
   </Target>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>
index 7b46189..503ff2e 100644 (file)
@@ -1,6 +1,8 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
   <PropertyGroup>
+    <ShortFrameworkName>windowsdesktop</ShortFrameworkName>
+    <ProductBrandPrefix>Microsoft Windows Desktop</ProductBrandPrefix>
+
     <RIDPropsFile>$(MSBuildThisFileDirectory)windowsdesktopRIDs.props</RIDPropsFile>
   </PropertyGroup>
 
index 25424e8..ab2a620 100644 (file)
@@ -1,9 +1,6 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project>
   <PropertyGroup>
     <IsFrameworkPackage>true</IsFrameworkPackage>
-    <ShortFrameworkName>windowsdesktop</ShortFrameworkName>
-    <ProductBrandPrefix>Microsoft Windows Desktop</ProductBrandPrefix>
   </PropertyGroup>
 
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" />
index c6311ed..35e3d84 100644 (file)
@@ -1,5 +1,2 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
+<Project Sdk="Microsoft.NET.Sdk">
 </Project>
index c6311ed..35e3d84 100644 (file)
@@ -1,5 +1,2 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
+<Project Sdk="Microsoft.NET.Sdk">
 </Project>
index 6523380..0dab35b 100644 (file)
@@ -1,6 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project>
+  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
 
   <PropertyGroup>
     <PreventImplementationReference Condition="'$(PackageTargetRuntime)' != ''">true</PreventImplementationReference>
@@ -10,11 +9,6 @@
 
     <FrameworkListTargetPath>data/</FrameworkListTargetPath>
 
-    <GenerateSharedFramework>true</GenerateSharedFramework>
-    <GenerateNetCoreAppRuntimeConfig>true</GenerateNetCoreAppRuntimeConfig>
-
-    <GenerateCompressedArchive>true</GenerateCompressedArchive>
-
     <TargetFrameworkName>netcoreapp</TargetFrameworkName>
     <TargetFrameworkVersion>3.0</TargetFrameworkVersion>
     <TargetFramework>$(TargetFrameworkName)$(TargetFrameworkVersion)</TargetFramework>
     <IgnoredReference Condition="'$(PackageTargetRuntime)' == ''" Include="DirectWriteForwarder" />
   </ItemGroup>
 
+  <!--
+    Wait for Microsoft.NETCore.App pkgprojs to be done with netcoreapp.depproj, but don't take any
+    dependency on the assets. ResolveAssemblyReference tasks running in parallel may try to write to
+    netcoreapp.depprojAssemblyReference.cache, hit the other's lock, and fail.
+  -->
+  <ItemGroup>
+    <WaitOnlyProjectReference Include="..\..\netcoreapp\pkg\legacy\*.pkgproj" />
+  </ItemGroup>
+
   <Target Name="GetNETCoreAppIgnoredReference" BeforeTargets="VerifyClosure">
     <MSBuild
       Projects="../../netcoreapp/src/netcoreapp.depproj"
       Properties="Configuration=netcoreapp"
       Targets="GetReferenceFilenames">
-      <Output TaskParameter="TargetOutputs"  ItemName="IgnoredReference" />
+      <Output TaskParameter="TargetOutputs" ItemName="IgnoredReference" />
     </MSBuild>
   </Target>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
+  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
 
   <!-- Don't validate this package as it doesn't actually represent a framework. -->
   <Target Name="ValidateFrameworkPackage" />
index 1c2b287..43e9a0b 100644 (file)
@@ -1,6 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" />
+<Project Sdk="Microsoft.NET.Sdk">
 
   <ItemGroup>
     <PackageReference Include="Microsoft.DotNet.Wpf.DncEng" Version="$(MicrosoftDotNetWpfDncEngPackageVersion)" />
@@ -39,5 +37,4 @@
   -->
   <Target Name="GetDependencyVersionFiles" />
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>