Add WindowsDesktop targeting pack nupkg, refactor pkg projects (dotnet/core-setup...
authorDavis Goodin <dagood@users.noreply.github.com>
Fri, 22 Feb 2019 00:19:35 +0000 (18:19 -0600)
committerGitHub <noreply@github.com>
Fri, 22 Feb 2019 00:19:35 +0000 (18:19 -0600)
* Refactor pkg projects

Instead of '.builds' projects, get Project items by calling a target in '.pkgproj' projects.

Move more common props/targets together.

* Add WindowsDesktop targeting pack nupkg

* Stop placing all files in data/ dir, only txt

* Change Pack nupkg type to DotnetPlatform

* Rename framework targets files

* Remove source redist: obsolete

* Require version files to be found and exist

Explicitly check if they exist to throw a clear error. The ReadAllText call would catch this, but it's verbose and doesn't say what the item's name is.

* DetermineRuntimeDependencies is not an override

* Remove package-specific asset exclusion

Use ExcludeAssets=All for CoreRT package to restore it but exclude Windows.winmd from redist.

Commit migrated from https://github.com/dotnet/core-setup/commit/2f91bd28d0c77eb72275f46ddd7cfc9f10196ba7

24 files changed:
src/installer/dependencies.props
src/installer/pkg/packages.builds
src/installer/pkg/projects/Microsoft.NETCore.App.Ref/Microsoft.NETCore.App.Ref.pkgproj [deleted file]
src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.builds [deleted file]
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/Microsoft.NETCore.DotNetHostPolicy.builds [deleted file]
src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/Microsoft.NETCore.DotNetHostResolver.builds [deleted file]
src/installer/pkg/projects/descriptions.json
src/installer/pkg/projects/dir.props
src/installer/pkg/projects/dir.targets
src/installer/pkg/projects/dir.traversal.targets
src/installer/pkg/projects/framework.dependency.targets [new file with mode: 0644]
src/installer/pkg/projects/framework.packaging.targets [new file with mode: 0644]
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.Ref.pkgproj [moved from src/installer/pkg/projects/Microsoft.NETCore.App.Ref/Microsoft.NETCore.App.Ref.builds with 57% similarity]
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.pkgproj [moved from src/installer/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.pkgproj with 68% similarity]
src/installer/pkg/projects/netcoreapp/pkg/Microsoft.NETCore.App.targets [moved from src/installer/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.targets with 100% similarity]
src/installer/pkg/projects/netcoreapp/pkg/dir.props [new file with mode: 0644]
src/installer/pkg/projects/netcoreapp/src/netcoreapp.depproj [moved from src/installer/pkg/projects/Microsoft.NETCore.App/src/Microsoft.NETCore.App.depproj with 62% similarity]
src/installer/pkg/projects/pkg.builds [moved from src/installer/pkg/projects/Microsoft.NETCore.App/src/Microsoft.NETCore.App.builds with 85% similarity]
src/installer/pkg/projects/src.builds [moved from src/installer/pkg/projects/Microsoft.NETCore.App/Microsoft.NETCore.App.builds with 85% similarity]
src/installer/pkg/projects/windowsdesktop/pkg/Microsoft.WindowsDesktop.App.Ref.pkgproj [moved from src/installer/pkg/projects/Microsoft.NETCore.DotNetHost/Microsoft.NETCore.DotNetHost.builds with 50% similarity]
src/installer/pkg/projects/windowsdesktop/pkg/dir.props [new file with mode: 0644]
src/installer/pkg/projects/windowsdesktop/src/windowsdesktop.depproj [new file with mode: 0644]
src/installer/src.builds
tools-local/tasks/CreateFrameworkListFile.cs

index 2c13c4e..5055882 100644 (file)
 
   <PropertyGroup>
     <MicrosoftDiaSymReaderNativePackageVersion>1.7.0</MicrosoftDiaSymReaderNativePackageVersion>
+  </PropertyGroup>
+
+  <!-- Get Windows.winmd for crossgen. -->
+  <PropertyGroup>
+    <MicrosoftTargetingPackPrivateWinRTPackage>Microsoft.TargetingPack.Private.WinRT</MicrosoftTargetingPackPrivateWinRTPackage>
     <MicrosoftTargetingPackPrivateWinRTPackageVersion>1.0.5</MicrosoftTargetingPackPrivateWinRTPackageVersion>
   </PropertyGroup>
 
index 0c34d60..6b04cc3 100644 (file)
@@ -10,7 +10,7 @@
   </PropertyGroup>  
 
   <ItemGroup>
-    <Project Include="$(ProjectsBasePath)*\*.builds">
+    <Project Include="$(ProjectsBasePath)pkg.builds">
       <AdditionalProperties>$(AdditionalProperties)</AdditionalProperties>
     </Project>
   </ItemGroup>  
diff --git a/src/installer/pkg/projects/Microsoft.NETCore.App.Ref/Microsoft.NETCore.App.Ref.pkgproj b/src/installer/pkg/projects/Microsoft.NETCore.App.Ref/Microsoft.NETCore.App.Ref.pkgproj
deleted file mode 100644 (file)
index d53fc43..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-<?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), dir.props))\dir.props" />
-
-  <PropertyGroup>
-    <PackageType>Data</PackageType>
-    <Version>$(SharedFrameworkNugetVersion)</Version>
-    <OmitDependencies>true</OmitDependencies>
-    <SkipValidatePackage>true</SkipValidatePackage>
-
-    <!-- Include the platform manifest in the data dir. -->
-    <PlatformManifestTargetPath>data/PlatformManifest.txt</PlatformManifestTargetPath>
-    <FrameworkListTargetPath>data/</FrameworkListTargetPath>
-
-    <!-- Exclude runtime.json from the package. -->
-    <IncludeRuntimeJson>false</IncludeRuntimeJson>
-    <IsLineupPackage>false</IsLineupPackage>
-
-    <!-- Remove package dependencies. -->
-    <ExcludeLineupReference>true</ExcludeLineupReference>
-    <PackProjectDependencies>false</PackProjectDependencies>
-
-    <!-- Location to lay out data/ dir. Used later to create installers. -->
-    <DataLayoutDir>$(IntermediateOutputPath)layout/</DataLayoutDir>
-  </PropertyGroup>
-
-  <!-- Redistribute package content from other nuget packages. -->
-  <ItemGroup>
-    <ProjectReference Include="..\Microsoft.NETCore.App\src\Microsoft.NETCore.App.depproj" />
-  </ItemGroup>
-
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-
-  <Target Name="GetPackageReport" />
-
-  <Target Name="MoveRefToData"
-          AfterTargets="ExpandProjectReferences">
-    <ItemGroup>
-      <!-- Move all refs into the data dir. Leave files like LICENSE.TXT in the root. -->
-      <File
-        Condition="$([System.String]::new('%(File.TargetPath)').StartsWith('ref'))"
-        TargetPath="data/" />
-    </ItemGroup>
-  </Target>
-
-  <!--
-    Copy the files in the package's data/ dir to a layout directory. This is what the targeting pack
-    installer will place in the dotnet install dir.
-
-    This extracts from the nupkg (zip) directly. An alternative would be using the PackageFile
-    items, but there's some risk of handling TargetPath metadata differently than NuGet does. Using
-    the nupkg directly ensures results are identical.
-  -->
-  <Target Name="CreateTargetingPackLayout"
-          AfterTargets="CreatePackage">
-    <PropertyGroup>
-      <TargetingPackNupkgFile>$(PackageOutputPath)$(Id).$(PackageVersion).nupkg</TargetingPackNupkgFile>
-    </PropertyGroup>
-
-    <ZipFileGetEntries TargetArchive="$(TargetingPackNupkgFile)">
-      <Output TaskParameter="Entries" ItemName="TargetingPackNupkgEntries" />
-    </ZipFileGetEntries>
-
-    <ItemGroup>
-      <TargetingPackDataEntries
-        Include="@(TargetingPackNupkgEntries)"
-        Condition="$([System.String]::new('%(TargetingPackNupkgEntries.Identity)').StartsWith('data/'))" />
-    </ItemGroup>
-
-    <ZipFileExtractToDirectory
-      SourceArchive="$(TargetingPackNupkgFile)"
-      DestinationDirectory="$(DataLayoutDir)packs/$(Id)/$(Version)/"
-      OverwriteDestination="true"
-      Include="@(TargetingPackDataEntries)" />
-  </Target>
-
-</Project>
diff --git a/src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.builds b/src/installer/pkg/projects/Microsoft.NETCore.DotNetAppHost/Microsoft.NETCore.DotNetAppHost.builds
deleted file mode 100644 (file)
index cef0386..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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), dir.props))\dir.props" />
-
-  <!-- We always build the identity/redirection package. However, the platform specific runtime-*.nupkg is built based upon the target OS we are building the product for. -->
-  <ItemGroup>
-    <Project Include="$(MSBuildProjectName).pkgproj" />
-  </ItemGroup>
-
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
-</Project>
\ No newline at end of file
diff --git a/src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/Microsoft.NETCore.DotNetHostPolicy.builds b/src/installer/pkg/projects/Microsoft.NETCore.DotNetHostPolicy/Microsoft.NETCore.DotNetHostPolicy.builds
deleted file mode 100644 (file)
index cef0386..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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), dir.props))\dir.props" />
-
-  <!-- We always build the identity/redirection package. However, the platform specific runtime-*.nupkg is built based upon the target OS we are building the product for. -->
-  <ItemGroup>
-    <Project Include="$(MSBuildProjectName).pkgproj" />
-  </ItemGroup>
-
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
-</Project>
\ No newline at end of file
diff --git a/src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/Microsoft.NETCore.DotNetHostResolver.builds b/src/installer/pkg/projects/Microsoft.NETCore.DotNetHostResolver/Microsoft.NETCore.DotNetHostResolver.builds
deleted file mode 100644 (file)
index cef0386..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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), dir.props))\dir.props" />
-
-  <!-- We always build the identity/redirection package. However, the platform specific runtime-*.nupkg is built based upon the target OS we are building the product for. -->
-  <ItemGroup>
-    <Project Include="$(MSBuildProjectName).pkgproj" />
-  </ItemGroup>
-
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
-</Project>
\ No newline at end of file
index 6cecbe1..b0db463 100644 (file)
         "Name": "Microsoft.NETCore.App.Ref",
         "Description": "A set of .NET APIs that are included in the default .NET Core application model. Contains reference assemblies, documentation, and other design-time assets.",
         "CommonTypes": [ ]
+    },
+    {
+        "Name": "Microsoft.WindowsDesktop.App.Ref",
+        "Description": "Windows Forms and WPF targeting pack. Contains reference assemblies, documentation, and other design-time assets.",
+        "CommonTypes": [ ]
     }
 ]
index 723bca6..caad2a1 100644 (file)
 
     <IsLineupPackage Condition="'$(PackageTargetRuntime)' == ''">true</IsLineupPackage>
 
-    <IncludeSourceFilesInPackage Condition="'$(DotNetBuildFromSource)' == 'true'">false</IncludeSourceFilesInPackage>
-    <IncludeSourceFilesInPackage Condition="'$(IncludeSourceFilesInPackage)' == ''">true</IncludeSourceFilesInPackage>
+    <BuildRuntimePackages>true</BuildRuntimePackages>
 
     <PackProjectDependencies>true</PackProjectDependencies>
   </PropertyGroup>
 
+  <ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true'">
+    <!-- WindowsDesktop packs currently depend on non-source-built App package. -->
+    <ProjectExclusions Include="windowsdesktop\**\*.*proj" />
+  </ItemGroup>
+
   <ItemGroup>
     <FrameworkListRootAttributes Include="Name" Value="$(NETCoreAppFrameworkBrandName)" />
     <FrameworkListRootAttributes Include="TargetFrameworkIdentifier" Value="$(NETCoreAppFrameworkIdentifier)" />
     </Otherwise>
   </Choose>
 
+  <!-- Detect framework pack suffix and apply defaults. -->
+  <PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Ref'))">
+    <IsTargetingPack>true</IsTargetingPack>
+
+    <!--
+      Prevent 'runtime.<rid>.Microsoft.<framework>.App.Ref' packages from being built.
+
+      Not the same as HasRuntimePackages, which is used to set up ProjectReferences on the runtime
+      packages and generate assets such as the platform manifest.
+    -->
+    <BuildRuntimePackages>false</BuildRuntimePackages>
+
+    <PackageType>DotnetPlatform</PackageType>
+    <Version>$(SharedFrameworkNugetVersion)</Version>
+
+    <!-- Include the platform manifest in the data dir. -->
+    <PlatformManifestTargetPath>data/PlatformManifest.txt</PlatformManifestTargetPath>
+    <FrameworkListTargetPath>data/</FrameworkListTargetPath>
+
+    <!-- Exclude runtime.json from the package. -->
+    <IncludeRuntimeJson>false</IncludeRuntimeJson>
+    <IsLineupPackage>false</IsLineupPackage>
+
+    <!-- Remove package dependencies. -->
+    <ExcludeLineupReference>true</ExcludeLineupReference>
+    <PackProjectDependencies>false</PackProjectDependencies>
+
+    <!-- Location to lay out pack contents. Used later to create installers. -->
+    <PackLayoutDir>$(IntermediateOutputPath)layout/</PackLayoutDir>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.depproj'">
+    <!-- we intentionally don't want to produce output -->
+    <OutputPath>unused</OutputPath>
+    <!--
+      we don't want any analyzers by ResolveNuGetPackageAssets
+      null-refs when this isn't set and an analyzer is in the packages
+    -->
+    <Language>unused</Language>
+    <NuGetTargetMoniker>$(NETCoreAppFrameworkMoniker)</NuGetTargetMoniker>
+    <NuGetTargetMonikerShort>$(NETCoreAppFramework)</NuGetTargetMonikerShort>
+    <PackageTargetFramework>$(NETCoreAppFramework)</PackageTargetFramework>
+    <CrossGenOutputPath>$(CrossGenRootPath)/$(MSBuildProjectName)/$(NuGetRuntimeIdentifier)</CrossGenOutputPath>
+    <ContainsPackageReferences>true</ContainsPackageReferences>
+    <RestorePackages>true</RestorePackages>
+    <RidSpecificAssets Condition="'$(NuGetRuntimeIdentifier)' != ''">true</RidSpecificAssets>
+    <IntermediateOutputPath>$(IntermediateOutputPath)$(NuGetRuntimeIdentifier)</IntermediateOutputPath>
+    <RestoreOutputPath>$(IntermediateOutputPath)</RestoreOutputPath>
+    <AdditionalRestoreArgs>/p:HasRuntimePackages=false /p:IntermediateOutputPath=$(IntermediateOutputPath)</AdditionalRestoreArgs>
+    <CrossGenSymbolsOutputPath>$(PackageSymbolsBinDir)/$(MSBuildProjectName)</CrossGenSymbolsOutputPath>
+  </PropertyGroup>
+
+  <PropertyGroup Condition="'$(IsFrameworkPackage)' == 'true'">
+    <Version>$(SharedFrameworkNugetVersion)</Version>
+    <OmitDependencies>true</OmitDependencies>
+    <SkipValidatePackage>true</SkipValidatePackage>
+  </PropertyGroup>
+
   <!-- Add required legal files to packages -->
   <ItemGroup Condition="'$(MSBuildProjectExtension)' == '.pkgproj'">
     <File Condition="Exists('$(PackageLicenseFile)')"
     </BuildRID>
     <BuildRID Include="@(_buildingOnRID)"/>
   </ItemGroup>
-  
-  <PropertyGroup>
-    <_projectExtension Condition="Exists('$(MSBuildProjectName).pkgproj')">.pkgproj</_projectExtension>
-    <_projectExtension Condition="'$(_projectExtension)' == '' AND Exists('$(MSBuildProjectName).depproj')">.depproj</_projectExtension>
-  </PropertyGroup>
 
   <ItemGroup Condition="'$(HasRuntimePackages)' != 'false'">
     <_project Include="@(BuildRID)">
       <AdditionalProperties>PackageTargetRuntime=%(Identity);NuGetRuntimeIdentifier=%(Identity);Platform=%(Platform)</AdditionalProperties>
     </_project>
 
-    <Project Include="@(_project->'$(MSBuildProjectName)$(_projectExtension)')" />
+    <RuntimeProject Include="@(_project->'$(MSBuildProjectFullPath)')" />
   </ItemGroup>
 
   <ItemGroup Condition="'$(PackageTargetRuntime)' == '' and '$(HasRuntimePackages)' != 'false'">
-    <ProjectReference Include="@(Project)" />
-  </ItemGroup>  
+    <ProjectReference Include="@(RuntimeProject)" />
+  </ItemGroup>
+  
 </Project>
\ No newline at end of file
index 80333f3..552318f 100644 (file)
@@ -1,6 +1,13 @@
 <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <Import Project="..\dir.targets" />
 
+  <!--
+    Include common targets for specific project types. These files include BuildTools target
+    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'"/>
+
   <UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
   <UsingTask TaskName="GenerateFileVersionProps" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
 
     </ItemGroup>
   </Target>
 
-  <Target Name="GetDependenciesToPackage"
+  <Target Name="GetNonPkgProjDependenciesToPackage"
           Condition="'$(PackProjectDependencies)' == 'true'"
           AfterTargets="ExpandProjectReferences">
     <!-- allow projects to provide dependencies -->
     <CreateFrameworkListFile
       Files="@(File)"
       TargetFile="$(FrameworkListFile)"
+      TargetFilePrefixes="ref/;runtimes/"
       RootAttributes="@(FrameworkListRootAttributes)" />
 
     <ItemGroup>
     </ItemGroup>
   </Target>
 
+  <!--
+    Copy the files in the package's data/ dir to a layout directory. This is what the targeting pack
+    installer will place in the dotnet install dir.
+
+    This extracts from the nupkg (zip) directly. An alternative would be using the PackageFile
+    items, but there's some risk of handling TargetPath metadata differently than NuGet does. Using
+    the nupkg directly ensures results are identical.
+  -->
+  <Target Name="CreateTargetingPackLayout"
+          AfterTargets="CreatePackage"
+          Condition="'$(IsTargetingPack)' == 'true'">
+    <PropertyGroup>
+      <TargetingPackNupkgFile>$(PackageOutputPath)$(Id).$(PackageVersion).nupkg</TargetingPackNupkgFile>
+    </PropertyGroup>
+
+    <ZipFileGetEntries TargetArchive="$(TargetingPackNupkgFile)">
+      <Output TaskParameter="Entries" ItemName="TargetingPackNupkgEntries" />
+    </ZipFileGetEntries>
+
+    <ItemGroup>
+      <TargetingPackDataEntries
+        Include="@(TargetingPackNupkgEntries)"
+        Condition="
+          $([System.String]::new('%(TargetingPackNupkgEntries.Identity)').StartsWith('data/')) OR
+          $([System.String]::new('%(TargetingPackNupkgEntries.Identity)').StartsWith('ref/')) OR
+          $([System.String]::new('%(TargetingPackNupkgEntries.Identity)').StartsWith('runtimes/'))" />
+    </ItemGroup>
+
+    <ZipFileExtractToDirectory
+      SourceArchive="$(TargetingPackNupkgFile)"
+      DestinationDirectory="$(PackLayoutDir)packs/$(Id)/$(Version)/"
+      OverwriteDestination="true"
+      Include="@(TargetingPackDataEntries)" />
+  </Target>
+
+  <!--
+    Get Project items: build the project, and build runtime packages if necessary. All projects in
+    this directory are ProjectProviders.
+  -->
+  <Target Name="GetProjectsToBuild" Returns="@(Project)">
+    <ItemGroup>
+      <Project Include="@(RuntimeProject)" Condition="'$(BuildRuntimePackages)' == 'true'" />
+      <Project Include="$(MSBuildProjectFullPath)" />
+    </ItemGroup>
+  </Target>
+
 </Project>
\ No newline at end of file
index ec26688..c9c88c7 100644 (file)
@@ -3,12 +3,34 @@
 
   <Import Project="$(MSBuildThisFileDirectory)..\dir.traversal.targets" />
 
-  <Target Name="FilterProjects" BeforeTargets="Build">
-    <Error Condition="'$(PackageRID)' == ''" Text="'PackageRID' property must be specified."/>
+  <!--
+    Some projects need to be built multiple times using different properties. Ask each
+    @(ProjectProvider) to give us the list of @(Project) items that need to be built. A pkgproj can
+    use this to build runtime packages, for example.
+  -->
+  <Target Name="ExpandProjects"
+          BeforeTargets="Build">
+    <MSBuild Projects="@(ProjectProvider)" Targets="GetProjectsToBuild">
+      <Output TaskParameter="TargetOutputs" ItemName="Project" />
+    </MSBuild>
+  </Target>
+
+  <!--
+    Filter runtime package builds down to the current RID and packages that aren't RID-specific.
+  -->
+  <Target Name="FilterProjects"
+          BeforeTargets="Build"
+          DependsOnTargets="ExpandProjects">
+    <Error Condition="'$(PackageRID)' == ''" Text="'PackageRID' property must be specified." />
 
     <!-- Only build packages for current RID or non-RID-specific -->
     <ItemGroup>
-      <_projectsToBuild Include="@(Project)" Condition="'%(Project.PackageTargetRuntime)' == '$(PackageRID)' OR '%(Project.BuidOnRID)' == '$(PackageRID)' OR '%(Project.PackageTargetRuntime)' == ''" />
+      <_projectsToBuild
+        Include="@(Project)"
+        Condition="
+          '%(Project.PackageTargetRuntime)' == '$(PackageRID)' OR
+          '%(Project.BuidOnRID)' == '$(PackageRID)' OR
+          '%(Project.PackageTargetRuntime)' == ''" />
     </ItemGroup>
 
     <ItemGroup>
diff --git a/src/installer/pkg/projects/framework.dependency.targets b/src/installer/pkg/projects/framework.dependency.targets
new file mode 100644 (file)
index 0000000..32cf04c
--- /dev/null
@@ -0,0 +1,91 @@
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <!--
+    Shared targets specific to dependency projects (depproj).
+  -->
+
+  <!-- Fetches all the file items from the packages that we want to redist -->
+  <Target Name="GetFilesFromPackages">
+    <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' != ''">
+      <!-- RID-specific: include all runtime files. -->
+      <FilesToPackage 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>
+    </ItemGroup>
+
+    <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' == ''">
+      <!-- Not RID-specific: include all reference files. -->
+      <FilesToPackage Include="@(Reference)">
+        <TargetPath>ref/$(PackageTargetFramework)</TargetPath>
+      </FilesToPackage>
+
+      <!-- include all doc files -->
+      <_docFilesToPackage Include="%(FilesToPackage.RootDir)%(FilesToPackage.Directory)**\%(FilesToPackage.FileName).xml" />
+
+      <FilesToPackage Include="@(_docFilesToPackage)">
+        <TargetPath>ref/$(PackageTargetFramework)/%(RecursiveDir)</TargetPath>
+      </FilesToPackage>
+    </ItemGroup>
+
+    <!-- Add versions file with the hashes of the repos we consume -->
+    <ItemGroup>
+      <FilesToPackage Include="$(IntermediateOutputPath)\$(FrameworkPackageName).versions.txt">
+        <TargetPath></TargetPath>
+      </FilesToPackage>
+    </ItemGroup>
+  </Target>
+
+  <Target Name="GetFilesToPackage"
+          DependsOnTargets="ResolveNuGetPackages;GetFilesFromPackages"
+          Returns="@(FilesToPackage)" />
+
+  <Target Name="GetDependenciesToPackage"
+          Condition="'@(DependenciesToPackage)' != ''"
+          DependsOnTargets="ResolveNuGetPackages"
+          Returns="@(_DependenciesToPackageWithVersion)">
+    <ItemGroup>
+      <!-- intersect ReferencedPackage with DependenciesToPackage -->
+      <_DependenciesToPackageWithVersion Include="@(PackageReference)" Condition="'@(PackageReference)' == '@(DependenciesToPackage)' AND '%(Identity)' != ''">
+        <TargetFramework>$(PackageTargetFramework)</TargetFramework>
+      </_DependenciesToPackageWithVersion>
+    </ItemGroup>
+
+    <Message Importance="low" Text="%(_DependenciesToPackageWithVersion.Identity) : %(_DependenciesToPackageWithVersion.Version) : %(_DependenciesToPackageWithVersion.TargetFramework)" />
+  </Target>
+
+  <!-- Creates the *.versions.txt file describing where data in this package came from. -->
+  <Target Name="GenerateHashVersionsFile" DependsOnTargets="GetDependencyVersionFiles">
+    <Error
+      Condition="!Exists('%(DependencyVersionFile.Identity)')"
+      Text="'%(Name)' version file does not exist: %(Identity)" />
+
+    <ItemGroup>
+      <DependencyVersionFile Content="$([System.IO.File]::ReadAllText('%(Identity)').Trim())" />
+
+      <_VersionsFileLines Include="core-setup $(LatestCommit)" />
+      <_VersionsFileLines Include="@(DependencyVersionFile ->'%(Name) %(Content)')" />
+    </ItemGroup>
+
+    <WriteLinesToFile Lines="@(_VersionsFileLines)"
+                       File="$(IntermediateOutputPath)\$(FrameworkPackageName).versions.txt"
+                       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 overrides (can't be shared with pkgproj) -->
+
+  <Target Name="Build" DependsOnTargets="GenerateHashVersionsFile;GetFilesToPackage" />
+
+</Project>
diff --git a/src/installer/pkg/projects/framework.packaging.targets b/src/installer/pkg/projects/framework.packaging.targets
new file mode 100644 (file)
index 0000000..dc0f766
--- /dev/null
@@ -0,0 +1,10 @@
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <!--
+    Shared targets specific to projects building 'Microsoft.*.App*' packages.
+  -->
+
+  <!-- Target overrides (can't be shared with other package projects) -->
+
+  <Target Name="GetPackageReport" />
+
+</Project>
@@ -1,14 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <HasRuntimePackages>false</HasRuntimePackages>
-  </PropertyGroup>
-
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-
-  <ItemGroup>
-    <Project Include="$(MSBuildProjectName).pkgproj" />
-  </ItemGroup>
-
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
 </Project>
@@ -3,10 +3,6 @@
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
 
   <PropertyGroup>
-    <Version>$(SharedFrameworkNugetVersion)</Version>
-    <OmitDependencies>true</OmitDependencies>
-    <SkipValidatePackage>true</SkipValidatePackage>
-    <ShouldCreateLayout>false</ShouldCreateLayout>
     <PreventImplementationReference Condition="'$(PackageTargetRuntime)' != ''">true</PreventImplementationReference>
     <BuildTargetPath>build/$(NETCoreAppFramework)</BuildTargetPath>
     <PlatformManifestTargetPath>$(BuildTargetPath)</PlatformManifestTargetPath>
@@ -16,7 +12,7 @@
   <!-- Identity / Reference package content -->
   <ItemGroup Condition="'$(PackageTargetRuntime)' == ''">
     <!-- reference RID specific packages to generate lineup -->
-    <ProjectReference Include="@(Project)" />
+    <ProjectReference Include="@(RuntimeProject)" />
 
     <!-- references the host packages -->
     <Dependency Include="Microsoft.NETCore.DotNetHostPolicy">
     </File>
   </ItemGroup>
 
-  <!-- Redistributed package content from other nuget packages-->
-  <ItemGroup>
-    <ProjectReference Include="src\Microsoft.NETCore.App.depproj">
-      <AdditionalProperties Condition="'$(PackageTargetRuntime)' != ''">NuGetRuntimeIdentifier=$(PackageTargetRuntime)</AdditionalProperties>
-    </ProjectReference>
-  </ItemGroup>
-
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-
-  <Target Name="GetPackageReport" />
 </Project>
diff --git a/src/installer/pkg/projects/netcoreapp/pkg/dir.props b/src/installer/pkg/projects/netcoreapp/pkg/dir.props
new file mode 100644 (file)
index 0000000..185c56b
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <IsFrameworkPackage>true</IsFrameworkPackage>
+  </PropertyGroup>
+
+  <Import Project="..\..\dir.props" />
+
+  <!-- Redistribute package content from other nuget packages. -->
+  <ItemGroup>
+    <ProjectReference Include="..\src\netcoreapp.depproj">
+      <AdditionalProperties Condition="'$(PackageTargetRuntime)' != ''">NuGetRuntimeIdentifier=$(PackageTargetRuntime)</AdditionalProperties>
+    </ProjectReference>
+  </ItemGroup>
+</Project>
@@ -1,24 +1,9 @@
 <?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), dir.props))\dir.props" />
+
   <PropertyGroup>
-    <!-- we intentionally don't want to produce output -->
-    <OutputPath>unused</OutputPath>
-    <!-- we don't want any analyzers by ResolveNuGetPackageAssets
-         null-refs when this isn't set and an analyzer is in the packages -->
-    <Language>unused</Language>
-    <NuGetTargetMoniker>$(NETCoreAppFrameworkMoniker)</NuGetTargetMoniker>
-    <NuGetTargetMonikerShort>$(NETCoreAppFramework)</NuGetTargetMonikerShort>
-    <PackageTargetFramework>$(NETCoreAppFramework)</PackageTargetFramework>
-    <PrimaryPackage>Microsoft.Private.CoreFx.NETCoreApp</PrimaryPackage>
-    <CrossGenOutputPath>$(CrossGenRootPath)/$(MSBuildProjectName)/$(NuGetRuntimeIdentifier)</CrossGenOutputPath>
-    <ContainsPackageReferences>true</ContainsPackageReferences>
-    <RestorePackages>true</RestorePackages>
-    <RidSpecificAssets Condition="'$(NuGetRuntimeIdentifier)' != ''">true</RidSpecificAssets>
-    <IntermediateOutputPath>$(IntermediateOutputPath)$(NuGetRuntimeIdentifier)</IntermediateOutputPath>
-    <RestoreOutputPath>$(IntermediateOutputPath)</RestoreOutputPath>
-    <AdditionalRestoreArgs>/p:HasRuntimePackages=false /p:IntermediateOutputPath=$(IntermediateOutputPath)</AdditionalRestoreArgs>
-    <CrossGenSymbolsOutputPath>$(PackageSymbolsBinDir)/$(MSBuildProjectName)</CrossGenSymbolsOutputPath>
+    <FrameworkPackageName>Microsoft.NETCore.App</FrameworkPackageName>
   </PropertyGroup>
 
   <ItemGroup>
@@ -40,7 +25,7 @@
     <PackageReference Include="NETStandard.Library">
       <Version>$(NETStandardLibraryPackageVersion)</Version>
     </PackageReference>
-    <PackageReference Include="Microsoft.TargetingPack.Private.WinRT">
+    <PackageReference Include="$(MicrosoftTargetingPackPrivateWinRTPackage)" ExcludeAssets="All">
       <Version>$(MicrosoftTargetingPackPrivateWinRTPackageVersion)</Version>
     </PackageReference>
   </ItemGroup>
@@ -53,8 +38,6 @@
     <DependenciesToPackage Include="Microsoft.NETCore.Targets" />
   </ItemGroup>
 
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-
   <!-- get paths from packages that are needed for cross-gen and other includes,
        only relevant for runtime-specific builds -->
   <Target Name="GetPackagePaths" Condition="'$(NuGetRuntimeIdentifier)' != ''" DependsOnTargets="ResolveNuGetPackages">
@@ -63,7 +46,9 @@
       <_runtimeCoreLib Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.FileName)%(ReferenceCopyLocalPaths.Extension)' == 'System.Private.CoreLib.dll'" />
       <_runtimeJIT Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.FileName)%(ReferenceCopyLocalPaths.Extension)' == '$(LibraryFilePrefix)clrjit$(LibraryFileExtension)'" />
       <_fxSystemRuntime Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.FileName)%(ReferenceCopyLocalPaths.Extension)' == 'System.Runtime.dll'" />
-      <_windowsWinMD Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.FileName)%(ReferenceCopyLocalPaths.Extension)' == 'Windows.winmd'" />
+
+      <!-- Find Windows.winmd in package cache to allow ExcludeAssets=All. -->
+      <_windowsWinMD Include="$(PackagesDir)$(MicrosoftTargetingPackPrivateWinRTPackage.ToLowerInvariant())/$(MicrosoftTargetingPackPrivateWinRTPackageVersion)/**/Windows.winmd" />
     </ItemGroup>
 
     <PropertyGroup>
     <Error Condition="!Exists('$(%(_requiredProperty.Identity))')" Text="Required property %(_requiredProperty.Identity) with value '$(%(_requiredProperty.Identity))' does not exist." />
   </Target>
 
-  <Target Name="GenerateHashVersionsFile" DependsOnTargets="GetPackagePaths;ResolveNuGetPackages">
-    <PropertyGroup>
-      <CoreFxVersionFile
-        Condition="$([System.String]::new('%(Reference.Identity)').ToLowerInvariant().Contains('system.runtime.dll'))">
-          $(PackagesDir)$([System.String]::new('%(Reference.NuGetPackageId)').ToLowerInvariant())/%(Reference.NuGetPackageVersion)/version.txt
-      </CoreFxVersionFile>
-      <CoreClrVersionFile Condition="'$(NuGetRuntimeIdentifier)' != ''">
-          $(_runtimePackagePath)/version.txt
-      </CoreClrVersionFile>
-    </PropertyGroup>
-    <ReadLinesFromFile File="$(CoreFxVersionFile)" Condition="Exists('$(CoreFxVersionFile)')">
-      <Output TaskParameter="Lines" PropertyName="CoreFxHash" />
-    </ReadLinesFromFile>
-    <ReadLinesFromFile File="$(CoreClrVersionFile)" Condition="Exists('$(CoreClrVersionFile)')">
-      <Output TaskParameter="Lines" PropertyName="CoreClrHash" />
-    </ReadLinesFromFile>
-
-    <Error Condition="!Exists('$(CoreFxVersionFile)')" Text="Failed to find the corefx version.txt file at $(CoreFxVersionFile)" />
-
+  <Target Name="GetDependencyVersionFiles" DependsOnTargets="GetPackagePaths;ResolveNuGetPackages">
     <ItemGroup>
-      <_VersionsFileLines Include="core-setup $(LatestCommit)" />
-      <_VersionsFileLines Include="corefx $(CoreFxHash)" />
-      <_VersionsFileLines Include="dotnet/versions/corefx $(CoreFxCurrentRef)" />
-      <_VersionsFileLines Include="coreclr $(CoreClrHash)" Condition="'$(CoreClrHash)'!=''" />
-      <_VersionsFileLines Include="dotnet/versions/coreclr $(CoreClrCurrentRef)" Condition="'$(CoreClrHash)'!=''" />
+      <_coreFxVersionFile
+        Include="$(PackagesDir)$([System.String]::new('%(Reference.NuGetPackageId)').ToLowerInvariant())/%(Reference.NuGetPackageVersion)/version.txt"
+        Condition="$([System.String]::new('%(Reference.Identity)').ToLowerInvariant().Contains('system.runtime.dll'))"
+        Name="corefx" />
+      <_coreClrVersionFile
+        Include="$(_runtimePackagePath)/version.txt"
+        Condition="'$(NuGetRuntimeIdentifier)' != ''"
+        Name="coreclr" />
+
+      <DependencyVersionFile Include="@(_coreFxVersionFile);@(_coreClrVersionFile)" />
     </ItemGroup>
 
-    <WriteLinesToFile Lines="@(_VersionsFileLines)"
-                       File="$(IntermediateOutputPath)\Microsoft.NETCore.App.versions.txt"
-                       Overwrite="true"/>
+    <Error
+      Condition="'@(_coreFxVersionFile)' == ''"
+      Text="Failed to locate corefx version.txt file." />
+
+    <Error
+      Condition="'@(_coreClrVersionFile)' == '' AND '$(NuGetRuntimeIdentifier)' != ''"
+      Text="Failed to locate coreclr version.txt file." />
   </Target>
 
-  <!-- Fetches all the file items from the packages that we want to redist -->
-  <Target Name="GetFilesFromPackages" DependsOnTargets="GetPackagePaths">
+  <!-- Fetches all the runtime items from the packages that we want to redist -->
+  <Target Name="GetRuntimeFilesFromPackages" DependsOnTargets="GetPackagePaths">
     <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' != ''">
-      <!-- RID-specific: include all runtime files except files in Microsoft.TargetingPack.Private.WinRT -->
-      <FilesToPackage Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != 'Microsoft.TargetingPack.Private.WinRT'">
-        <!-- 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>
       <_ToolsToPackage Include="$(_runtimePackagePath)/tools/**/*.*"/>
       <FilesToPackage Include="@(_ToolsToPackage)">
         <NuGetPackageId>$(_runtimePackageId)</NuGetPackageId>
         <IsNative>true</IsNative>
       </FilesToPackage>
     </ItemGroup>
-
-    <ItemGroup Condition="'$(NuGetRuntimeIdentifier)' == ''">
-      <!-- Not RID-specific: include all reference files except files in Microsoft.TargetingPack.Private.WinRT -->
-      <FilesToPackage Include="@(Reference)" Condition="'%(Reference.NuGetPackageId)' != 'Microsoft.TargetingPack.Private.WinRT'">
-        <TargetPath>ref/$(PackageTargetFramework)</TargetPath>
-      </FilesToPackage>
-
-      <!-- include all doc files -->
-      <_docFilesToPackage Include="%(FilesToPackage.RootDir)%(FilesToPackage.Directory)**\%(FilesToPackage.FileName).xml" />
-
-      <FilesToPackage Include="@(_docFilesToPackage)">
-        <TargetPath>ref/$(PackageTargetFramework)/%(RecursiveDir)</TargetPath>
-      </FilesToPackage>
-    </ItemGroup>
-
-    <ItemGroup Condition="'$(IncludeSourceFilesInPackage)' == 'true'">
-      <!-- pick up any src our sources directory from packages contributing files -->
-      <_sourcePathCandidate Include="@(FilesToPackage->'$(PackagesDir)\%(NuGetPackageId)\%(NuGetPackageVersion)\sources')" />
-      <_sourcePathCandidate Include="@(FilesToPackage->'$(PackagesDir)\%(NuGetPackageId)\%(NuGetPackageVersion)\src')" />
-      <_sourcePath Include="@(_sourcePathCandidate)" Condition="Exists('%(Identity)')" />
-    </ItemGroup>
-
-    <!-- Add versions file with the hashes of the repos we consume -->
-    <ItemGroup>
-      <FilesToPackage Include="$(IntermediateOutputPath)\Microsoft.NETCore.App.versions.txt">
-        <TargetPath></TargetPath>
-      </FilesToPackage>
-    </ItemGroup>
-
-    <!-- on windows workaround max-path -->
-    <!-- this can be removed once we build on core MSBuild which supports long paths. -->
-    <ItemGroup Condition="'$(OsEnvironment)'=='Windows_NT'">
-      <!-- choose a shorter path name, excluding package version -->
-      <_shortSourcePath Include="@(_sourcePath->'$(ObjDir.Replace('/', '\'))src-%(NuGetPackageId)')">
-        <Original>%(_sourcePath.FullPath)</Original>
-      </_shortSourcePath>
-      <_sourcePath Remove="@(_sourcePath)" />
-      <_sourcePath Include="@(_shortSourcePath)" />
-    </ItemGroup>
-    <RemoveDir Condition="'@(_shortSourcePath)' != '' AND Exists('%(_shortSourcePath.Identity)')" Directories="%(_shortSourcePath.Identity)" />
-    <Exec Condition="'@(_shortSourcePath)' != ''" Command="mklink /J %(_shortSourcePath.Identity) %(_shortSourcePath.Original)" />
-
-    <ItemGroup>
-      <FilesToPackage Include="%(_sourcePath.Identity)\%2A%2A\%2A.%2A">
-        <TargetPath>src</TargetPath>
-        <IsSourceCodeFile>true</IsSourceCodeFile>
-      </FilesToPackage>
-    </ItemGroup>
   </Target>
 
   <!-- Prepares all items for cross-gen and replaces package file items with their cross-gen'ed equivalents -->
   </Target>
 
   <Target Name="CrossGen"
+          BeforeTargets="Build"
           DependsOnTargets="CreateCrossGenImages;CreateCrossGenSymbols" />
 
   <Target Name="CreateCrossGenImages"
     </ItemGroup>
   </Target>
 
-  <Target Name="GetFilesToPackage"
-          DependsOnTargets="ResolveNuGetPackages;GetFilesFromPackages;PrepareForCrossGen;GetCrossGenSymbolsFiles"
-          Returns="@(FilesToPackage)" />
-
-  <Target Name="GetDependenciesToPackage" Condition="'@(DependenciesToPackage)' != ''" DependsOnTargets="ResolveNuGetPackages" Returns="@(_DependenciesToPackageWithVersion)">
-    <ItemGroup>
-      <!-- intersect ReferencedPackage with DependenciesToPackage -->
-      <_DependenciesToPackageWithVersion Include="@(PackageReference)" Condition="'@(PackageReference)' == '@(DependenciesToPackage)' AND '%(Identity)' != ''">
-        <TargetFramework>$(PackageTargetFramework)</TargetFramework>
-      </_DependenciesToPackageWithVersion>
-    </ItemGroup>
-
-    <Message Importance="low" Text="%(_DependenciesToPackageWithVersion.Identity) : %(_DependenciesToPackageWithVersion.Version) : %(_DependenciesToPackageWithVersion.TargetFramework)" />
+  <Target Name="GetRuntimeFilesToPackage"
+          BeforeTargets="GetFilesToPackage"
+          DependsOnTargets="GetRuntimeFilesFromPackages;PrepareForCrossGen;GetCrossGenSymbolsFiles">
   </Target>
 
-  <!-- Run crossgen -->
-  <Target Name="Build" DependsOnTargets="GenerateHashVersionsFile;CrossGen;GetFilesToPackage" />
-
-  <!-- remove when fixing https://github.com/dotnet/buildtools/issues/1273 -->
-  <Target Name="DetermineRuntimeDependencies" />
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
 </Project>
@@ -3,7 +3,7 @@
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
 
   <ItemGroup>
-    <Project Include="$(MSBuildProjectName).depproj" />
+    <ProjectProvider Include="**\*.pkgproj" Exclude="@(ProjectExclusions)" />
   </ItemGroup>
 
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
@@ -3,7 +3,7 @@
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
 
   <ItemGroup>
-    <Project Include="$(MSBuildProjectName).pkgproj" />
+    <ProjectProvider Include="**\*.depproj" Exclude="@(ProjectExclusions)" />
   </ItemGroup>
 
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
@@ -1,11 +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), dir.props))\dir.props" />
-
-  <!-- We always build the identity/redirection package. However, the platform specific runtime-*.nupkg is built based upon the target OS we are building the product for. -->
-  <ItemGroup>
-    <Project Include="$(MSBuildProjectName).pkgproj" />
-  </ItemGroup>
-
-  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
 </Project>
diff --git a/src/installer/pkg/projects/windowsdesktop/pkg/dir.props b/src/installer/pkg/projects/windowsdesktop/pkg/dir.props
new file mode 100644 (file)
index 0000000..4157e3c
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <IsFrameworkPackage>true</IsFrameworkPackage>
+  </PropertyGroup>
+
+  <Import Project="..\..\dir.props" />
+
+  <!-- Redistribute package content from other nuget packages. -->
+  <ItemGroup>
+    <ProjectReference Include="..\src\windowsdesktop.depproj">
+      <AdditionalProperties Condition="'$(PackageTargetRuntime)' != ''">NuGetRuntimeIdentifier=$(PackageTargetRuntime)</AdditionalProperties>
+    </ProjectReference>
+  </ItemGroup>
+</Project>
diff --git a/src/installer/pkg/projects/windowsdesktop/src/windowsdesktop.depproj b/src/installer/pkg/projects/windowsdesktop/src/windowsdesktop.depproj
new file mode 100644 (file)
index 0000000..471db17
--- /dev/null
@@ -0,0 +1,25 @@
+<?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), dir.props))\dir.props" />
+
+  <PropertyGroup>
+    <FrameworkPackageName>Microsoft.WindowsDesktop.App</FrameworkPackageName>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.WindowsDesktop.App">
+      <Version>$(MicrosoftWindowsDesktopAppPackageVersion)</Version>
+    </PackageReference>
+  </ItemGroup>
+
+  <Target Name="GetDependencyVersionFiles" DependsOnTargets="ResolveNuGetPackages">
+    <ItemGroup>
+      <DependencyVersionFile
+        Include="$(PackagesDir)$([System.String]::new('%(Reference.NuGetPackageId)').ToLowerInvariant())/%(Reference.NuGetPackageVersion)/version.txt"
+        Condition="$([System.String]::new('%(Reference.Identity)').ToLowerInvariant().Contains('system.xaml.dll'))"
+        Name="dotnet-trusted" />
+    </ItemGroup>
+  </Target>
+
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
index f1a5bd9..be141c4 100644 (file)
@@ -10,7 +10,7 @@
   <ItemGroup>
     <Project Include="$(MSBuildThisFileDirectory)corehost/build.proj" />
     <Project Include="$(MSBuildThisFileDirectory)managed/dir.proj" />
-    <Project Include="$(MSBuildThisFileDirectory)pkg/**/src/*.builds" />
+    <Project Include="$(MSBuildThisFileDirectory)pkg/projects/src.builds" />
   </ItemGroup>
 
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
index 37e5aff..fab7208 100644 (file)
@@ -21,6 +21,8 @@ namespace Microsoft.DotNet.Build.Tasks
         [Required]
         public string TargetFile { get; set; }
 
+        public string[] TargetFilePrefixes { get; set; }
+
         /// <summary>
         /// Extra attributes to place on the root node.
         /// 
@@ -39,7 +41,7 @@ namespace Microsoft.DotNet.Build.Tasks
 
             foreach (var f in Files
                 .Where(item =>
-                    item.GetMetadata("TargetPath")?.StartsWith("data/") == true &&
+                    IsTargetPathIncluded(item) &&
                     item.ItemSpec.EndsWith(".dll", StringComparison.OrdinalIgnoreCase))
                 .Select(item => new
                 {
@@ -78,5 +80,11 @@ namespace Microsoft.DotNet.Build.Tasks
 
             return !Log.HasLoggedErrors;
         }
+
+        private bool IsTargetPathIncluded(ITaskItem item)
+        {
+            return TargetFilePrefixes
+                ?.Any(prefix => item.GetMetadata("TargetPath")?.StartsWith(prefix) == true) ?? true;
+        }
     }
 }