فهرست منبع

Generate PlatformManifest and package conflict overrides for Microsoft.AspNetCore.App (#4072)

This generates additional metadata for the .NET Core SDK to resolve conflicts between Microsoft.AspNetCore.App and PackageReferences which contain the same assemblies.
Nate McMaster 7 سال پیش
والد
کامیت
fd1a5b43f1

+ 7 - 3
.azure/pipelines/fast-pr-validation.yml

@@ -1,7 +1,11 @@
+# Don't run CI for this config
+trigger: none
 
-trigger:
-- master
-- release/*
+# Run PR validation on all branches
+pr:
+  branches:
+    include:
+    - '*'
 
 jobs:
 - template: jobs/default-build.yml

+ 7 - 0
build/dependencies.props

@@ -6,6 +6,7 @@
     <!-- MicrosoftNETCoreApp30PackageVersion is assigned at the bottom so it can automatically pick up MicrosoftNETCoreAppPackageVersion in an orchestrated build. -->
     <MicrosoftNETCoreAppPackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreAppPackageVersion>
     <MicrosoftNETCoreDotNetAppHostPackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreDotNetAppHostPackageVersion>
+    <MicrosoftDotNetPlatformAbstractionsPackageVersion>3.0.0-preview1-26907-05</MicrosoftDotNetPlatformAbstractionsPackageVersion>
     <MicrosoftWin32RegistryPackageVersion>4.6.0-preview1-26907-04</MicrosoftWin32RegistryPackageVersion>
     <SystemBuffersPackageVersion>4.6.0-preview1-26907-04</SystemBuffersPackageVersion>
     <SystemCollectionsImmutablePackageVersion>1.6.0-preview1-26907-04</SystemCollectionsImmutablePackageVersion>
@@ -21,10 +22,12 @@
     <SystemReflectionMetadataPackageVersion>1.7.0-preview1-26907-04</SystemReflectionMetadataPackageVersion>
     <SystemRuntimeCompilerServicesUnsafePackageVersion>4.6.0-preview1-26907-04</SystemRuntimeCompilerServicesUnsafePackageVersion>
     <SystemSecurityCryptographyCngPackageVersion>4.6.0-preview1-26907-04</SystemSecurityCryptographyCngPackageVersion>
+    <SystemSecurityCryptographyPkcsPackageVersion>4.6.0-preview1-26907-04</SystemSecurityCryptographyPkcsPackageVersion>
     <SystemSecurityCryptographyXmlPackageVersion>4.6.0-preview1-26907-04</SystemSecurityCryptographyXmlPackageVersion>
     <SystemSecurityPermissionsPackageVersion>4.6.0-preview1-26907-04</SystemSecurityPermissionsPackageVersion>
     <SystemSecurityPrincipalWindowsPackageVersion>4.6.0-preview1-26907-04</SystemSecurityPrincipalWindowsPackageVersion>
     <SystemServiceProcessServiceControllerPackageVersion>4.6.0-preview1-26907-04</SystemServiceProcessServiceControllerPackageVersion>
+    <SystemTextEncodingCodePagesPackageVersion>4.6.0-preview1-26907-04</SystemTextEncodingCodePagesPackageVersion>
     <SystemTextEncodingsWebPackageVersion>4.6.0-preview1-26907-04</SystemTextEncodingsWebPackageVersion>
     <SystemThreadingChannelsPackageVersion>4.6.0-preview1-26907-04</SystemThreadingChannelsPackageVersion>
     <SystemThreadingTasksDataflowPackageVersion>4.10.0-preview1-26907-04</SystemThreadingTasksDataflowPackageVersion>
@@ -170,8 +173,12 @@
     <MicrosoftDotNetProjectModelPackageVersion>1.0.0-rc3-003121</MicrosoftDotNetProjectModelPackageVersion>
     <MicrosoftExtensionsPlatformAbstractionsPackageVersion>1.1.0</MicrosoftExtensionsPlatformAbstractionsPackageVersion>
     <MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>3.19.8</MicrosoftIdentityModelClientsActiveDirectoryPackageVersion>
+    <MicrosoftIdentityModelJsonWebTokensPackageVersion>5.3.0</MicrosoftIdentityModelJsonWebTokensPackageVersion>
+    <MicrosoftIdentityModelLoggingPackageVersion>5.3.0</MicrosoftIdentityModelLoggingPackageVersion>
     <MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion>5.3.0</MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion>
+    <MicrosoftIdentityModelProtocolsPackageVersion>5.3.0</MicrosoftIdentityModelProtocolsPackageVersion>
     <MicrosoftIdentityModelProtocolsWsFederationPackageVersion>5.3.0</MicrosoftIdentityModelProtocolsWsFederationPackageVersion>
+    <MicrosoftIdentityModelTokensPackageVersion>5.3.0</MicrosoftIdentityModelTokensPackageVersion>
     <MicrosoftInternalAspNetCoreH2SpecAllPackageVersion>2.1.1</MicrosoftInternalAspNetCoreH2SpecAllPackageVersion>
     <MicrosoftNETCoreApp10PackageVersion>1.0.12</MicrosoftNETCoreApp10PackageVersion>
     <MicrosoftNETCoreApp11PackageVersion>1.1.9</MicrosoftNETCoreApp11PackageVersion>

+ 7 - 0
build/external-dependencies.props

@@ -136,8 +136,12 @@
     <ExternalDependency Include="Microsoft.DiaSymReader.Native" Version="$(MicrosoftDiaSymReaderNativePackageVersion)" />
     <ExternalDependency Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
     <ExternalDependency Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="$(MicrosoftIdentityModelClientsActiveDirectoryPackageVersion)" />
+    <ExternalDependency Include="Microsoft.IdentityModel.JsonWebTokens" Version="$(MicrosoftIdentityModelJsonWebTokensPackageVersion)" />
+    <ExternalDependency Include="Microsoft.IdentityModel.Logging" Version="$(MicrosoftIdentityModelLoggingPackageVersion)" />
     <ExternalDependency Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion)" />
     <ExternalDependency Include="Microsoft.IdentityModel.Protocols.WsFederation" Version="$(MicrosoftIdentityModelProtocolsWsFederationPackageVersion)" />
+    <ExternalDependency Include="Microsoft.IdentityModel.Protocols" Version="$(MicrosoftIdentityModelProtocolsPackageVersion)" />
+    <ExternalDependency Include="Microsoft.IdentityModel.Tokens" Version="$(MicrosoftIdentityModelTokensPackageVersion)" />
     <ExternalDependency Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
 
     <!-- Multiple versions of this package required to support all netcoreapp versions -->
@@ -154,6 +158,7 @@
     <ExternalDependency Include="Microsoft.NETCore.DotNetAppHost" Version="$(MicrosoftNETCoreDotNetAppHost21PackageVersion)" VariableName="MicrosoftNETCoreDotNetAppHost21PackageVersion" />
     <ExternalDependency Include="Microsoft.NETCore.DotNetAppHost" Version="$(MicrosoftNETCoreDotNetAppHost22PackageVersion)" VariableName="MicrosoftNETCoreDotNetAppHost22PackageVersion" />
     <ExternalDependency Include="Microsoft.NETCore.DotNetAppHost" Version="$(MicrosoftNETCoreDotNetAppHostPackageVersion)" />
+    <ExternalDependency Include="Microsoft.DotNet.PlatformAbstractions" Version="$(MicrosoftDotNetPlatformAbstractionsPackageVersion)" />
 
     <ExternalDependency Include="Microsoft.NETCore.Windows.ApiSets" Version="$(MicrosoftNETCoreWindowsApiSetsPackageVersion)" />
     <ExternalDependency Include="Microsoft.NETFramework.ReferenceAssemblies" Version="$(MicrosoftNETFrameworkReferenceAssembliesPackageVersion)" />
@@ -229,10 +234,12 @@
     <ExternalDependency Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafePackageVersion)" />
     <ExternalDependency Include="System.Runtime.InteropServices.RuntimeInformation" Version="$(SystemRuntimeInteropServicesRuntimeInformationPackageVersion)" />
     <ExternalDependency Include="System.Security.Cryptography.Cng" Version="$(SystemSecurityCryptographyCngPackageVersion)" />
+    <ExternalDependency Include="System.Security.Cryptography.Pkcs" Version="$(SystemSecurityCryptographyPkcsPackageVersion)" />
     <ExternalDependency Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlPackageVersion)" />
     <ExternalDependency Include="System.Security.Permissions" Version="$(SystemSecurityPermissionsPackageVersion)" />
     <ExternalDependency Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsPackageVersion)" />
     <ExternalDependency Include="System.ServiceProcess.ServiceController" Version="$(SystemServiceProcessServiceControllerPackageVersion)" />
+    <ExternalDependency Include="System.Text.Encoding.CodePages" Version="$(SystemTextEncodingCodePagesPackageVersion)" />
     <ExternalDependency Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebPackageVersion)" />
     <ExternalDependency Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
     <ExternalDependency Include="System.Threading.Tasks.Dataflow" Version="$(SystemThreadingTasksDataflowPackageVersion)" />

+ 24 - 5
build/tasks/ProcessSharedFrameworkDeps.cs → build/tasks/GenerateSharedFrameworkMetadataFiles.cs

@@ -14,7 +14,7 @@ using RepoTasks.Utilities;
 
 namespace RepoTasks
 {
-    public class ProcessSharedFrameworkDeps : Task
+    public class GenerateSharedFrameworkMetadataFiles : Task
     {
         [Required]
         public string AssetsFilePath { get; set; }
@@ -23,7 +23,7 @@ namespace RepoTasks
         public string DepsFilePath { get; set; }
 
         [Required]
-        public string OutputPath { get; set; }
+        public string DepsFileOutputPath { get; set; }
 
         [Required]
         public string TargetFramework { get; set; }
@@ -37,6 +37,9 @@ namespace RepoTasks
         [Required]
         public string BaseRuntimeIdentifier { get; set; }
 
+        [Required]
+        public string PlatformManifestOutputPath { get; set; }
+
         public override bool Execute()
         {
             ExecuteCore();
@@ -65,27 +68,38 @@ namespace RepoTasks
             var runtimeFiles = new List<RuntimeFile>();
             var nativeFiles = new List<RuntimeFile>();
             var resourceAssemblies = new List<ResourceAssembly>();
+            var platformManifest = new List<string>();
 
             foreach (var library in context.RuntimeLibraries)
             {
                 foreach (var file in library.RuntimeAssemblyGroups.SelectMany(g => g.RuntimeFiles))
                 {
-                    var path = $"runtimes/{context.Target.Runtime}/lib/{TargetFramework}/{Path.GetFileName(file.Path)}";
+                    var fileName = Path.GetFileName(file.Path);
+                    var path = $"runtimes/{context.Target.Runtime}/lib/{TargetFramework}/{fileName}";
                     runtimeFiles.Add(
                         new RuntimeFile(
                             path,
                             file.AssemblyVersion,
                             file.FileVersion));
+
+                    platformManifest.Add($"{fileName}|{FrameworkName}|{file.AssemblyVersion}|{file.FileVersion}");
                 }
 
                 foreach (var file in library.NativeLibraryGroups.SelectMany(g => g.RuntimeFiles))
                 {
-                    var path = $"runtimes/{context.Target.Runtime}/native/{Path.GetFileName(file.Path)}";
+                    var fileName = Path.GetFileName(file.Path);
+                    var path = $"runtimes/{context.Target.Runtime}/native/{fileName}";
                     nativeFiles.Add(
                         new RuntimeFile(
                             path,
                             file.AssemblyVersion,
                             file.FileVersion));
+
+                    if (!Version.TryParse(file.FileVersion, out var fileVersion))
+                    {
+                        fileVersion = new Version(0, 0, 0, 0);
+                    }
+                    platformManifest.Add($"{fileName}|{FrameworkName}||{fileVersion}");
                 }
 
                 resourceAssemblies.AddRange(
@@ -126,7 +140,12 @@ namespace RepoTasks
                 expandedGraph
                 );
 
-            using (var depsStream = File.Create(OutputPath))
+            Directory.CreateDirectory(Path.GetDirectoryName(PlatformManifestOutputPath));
+            Directory.CreateDirectory(Path.GetDirectoryName(DepsFileOutputPath));
+
+            File.WriteAllLines(PlatformManifestOutputPath, platformManifest.OrderBy(n => n));
+
+            using (var depsStream = File.Create(DepsFileOutputPath))
             {
                 new DependencyContextWriter().Write(context, depsStream);
             }

+ 1 - 1
build/tasks/RepoTasks.tasks

@@ -10,7 +10,7 @@
   <UsingTask TaskName="RepoTasks.GetDocXmlFiles" AssemblyFile="$(_RepoTaskAssembly)" />
   <UsingTask TaskName="RepoTasks.JoinItems" AssemblyFile="$(_RepoTaskAssembly)" />
   <UsingTask TaskName="RepoTasks.OrderBy" AssemblyFile="$(_RepoTaskAssembly)" />
-  <UsingTask TaskName="RepoTasks.ProcessSharedFrameworkDeps" AssemblyFile="$(_RepoTaskAssembly)" />
+  <UsingTask TaskName="RepoTasks.GenerateSharedFrameworkMetadataFiles" AssemblyFile="$(_RepoTaskAssembly)" />
   <UsingTask TaskName="RepoTasks.PublishToAzureBlob" AssemblyFile="$(_RepoTaskAssembly)" />
 
   <!-- tools from dotnet-buildtools -->

+ 1 - 1
modules/HttpClientFactory

@@ -1 +1 @@
-Subproject commit 7c4f9479b4753a37c8b0669a883002e5e448cc94
+Subproject commit 4dfcf7485e62819d0d73c00d7e7eb53d75abdbd3

+ 1 - 1
modules/MusicStore

@@ -1 +1 @@
-Subproject commit aca4b432e157c5e9063f551af8bff3de7641b744
+Subproject commit 2b0ea782be84655f9d6320b591efcb6dc1a38177

+ 1 - 1
modules/Templating

@@ -1 +1 @@
-Subproject commit 514fcdcba533eb70a670b9ccc2073d67f6c6f9ca
+Subproject commit 0af2acd6fff0f51ec42183f5a5b01f8f0712af5f

+ 35 - 3
src/Framework/Microsoft.AspNetCore.App.props

@@ -3,8 +3,16 @@
 -->
 <Project>
 
+  <ItemDefinitionGroup>
+    <Dependency>
+      <!-- Only specified if it differs from PackageId -->
+      <AssemblyName></AssemblyName>
+    </Dependency>
+  </ItemDefinitionGroup>
+
   <ItemGroup>
-    <Dependency Include="Microsoft.AspNet.WebApi.Client"                               Version="$(MicrosoftAspNetWebApiClientPackageVersion)" />
+    <Dependency Include="Microsoft.AspNet.WebApi.Client"                               Version="$(MicrosoftAspNetWebApiClientPackageVersion)"
+           AssemblyName="System.Net.Http.Formatting" />
     <Dependency Include="Microsoft.AspNetCore.Antiforgery"                             Version="$(MicrosoftAspNetCoreAntiforgeryPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Authentication.Abstractions"             Version="$(MicrosoftAspNetCoreAuthenticationAbstractionsPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Authentication.Cookies"                  Version="$(MicrosoftAspNetCoreAuthenticationCookiesPackageVersion)" />
@@ -40,10 +48,10 @@
     <Dependency Include="Microsoft.AspNetCore.HttpOverrides"                           Version="$(MicrosoftAspNetCoreHttpOverridesPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.HttpsPolicy"                             Version="$(MicrosoftAspNetCoreHttpsPolicyPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Identity"                                Version="$(MicrosoftAspNetCoreIdentityPackageVersion)" />
+    <Dependency Include="Microsoft.AspNetCore.JsonPatch"                               Version="$(MicrosoftAspNetCoreJsonPatchPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Localization.Routing"                    Version="$(MicrosoftAspNetCoreLocalizationRoutingPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Localization"                            Version="$(MicrosoftAspNetCoreLocalizationPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.Abstractions"                        Version="$(MicrosoftAspNetCoreMvcAbstractionsPackageVersion)" />
-    <Dependency Include="Microsoft.AspNetCore.Mvc.Analyzers"                           Version="$(MicrosoftAspNetCoreMvcAnalyzersPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.ApiExplorer"                         Version="$(MicrosoftAspNetCoreMvcApiExplorerPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.Core"                                Version="$(MicrosoftAspNetCoreMvcCorePackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.Cors"                                Version="$(MicrosoftAspNetCoreMvcCorsPackageVersion)" />
@@ -51,13 +59,15 @@
     <Dependency Include="Microsoft.AspNetCore.Mvc.Formatters.Json"                     Version="$(MicrosoftAspNetCoreMvcFormattersJsonPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.Formatters.Xml"                      Version="$(MicrosoftAspNetCoreMvcFormattersXmlPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.Localization"                        Version="$(MicrosoftAspNetCoreMvcLocalizationPackageVersion)" />
+    <Dependency Include="Microsoft.AspNetCore.Mvc.Razor.Extensions"                    Version="$(MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.Razor"                               Version="$(MicrosoftAspNetCoreMvcRazorPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.RazorPages"                          Version="$(MicrosoftAspNetCoreMvcRazorPagesPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.TagHelpers"                          Version="$(MicrosoftAspNetCoreMvcTagHelpersPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc.ViewFeatures"                        Version="$(MicrosoftAspNetCoreMvcViewFeaturesPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Mvc"                                     Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
-    <Dependency Include="Microsoft.AspNetCore.Razor"                                   Version="$(MicrosoftAspNetCoreRazorPackageVersion)" />
+    <Dependency Include="Microsoft.AspNetCore.Razor.Language"                          Version="$(MicrosoftAspNetCoreRazorLanguagePackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.Razor.Runtime"                           Version="$(MicrosoftAspNetCoreRazorRuntimePackageVersion)" />
+    <Dependency Include="Microsoft.AspNetCore.Razor"                                   Version="$(MicrosoftAspNetCoreRazorPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.ResponseCaching.Abstractions"            Version="$(MicrosoftAspNetCoreResponseCachingAbstractionsPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.ResponseCaching"                         Version="$(MicrosoftAspNetCoreResponseCachingPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.ResponseCompression"                     Version="$(MicrosoftAspNetCoreResponseCompressionPackageVersion)" />
@@ -81,6 +91,11 @@
     <Dependency Include="Microsoft.AspNetCore.WebSockets"                              Version="$(MicrosoftAspNetCoreWebSocketsPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore.WebUtilities"                            Version="$(MicrosoftAspNetCoreWebUtilitiesPackageVersion)" />
     <Dependency Include="Microsoft.AspNetCore"                                         Version="$(MicrosoftAspNetCorePackageVersion)" />
+    <Dependency Include="Microsoft.CodeAnalysis.CSharp"                                Version="$(MicrosoftCodeAnalysisCSharpPackageVersion)" />
+    <Dependency Include="Microsoft.CodeAnalysis.Razor"                                 Version="$(MicrosoftCodeAnalysisRazorPackageVersion)" />
+    <Dependency Include="Microsoft.CodeAnalysis.Common"                                Version="$(MicrosoftCodeAnalysisCommonPackageVersion)"
+           AssemblyName="Microsoft.CodeAnalysis" />
+    <Dependency Include="Microsoft.DotNet.PlatformAbstractions"                        Version="$(MicrosoftDotNetPlatformAbstractionsPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.Caching.Abstractions"                    Version="$(MicrosoftExtensionsCachingAbstractionsPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.Caching.Memory"                          Version="$(MicrosoftExtensionsCachingMemoryPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.Configuration.Abstractions"              Version="$(MicrosoftExtensionsConfigurationAbstractionsPackageVersion)" />
@@ -96,6 +111,7 @@
     <Dependency Include="Microsoft.Extensions.Configuration"                           Version="$(MicrosoftExtensionsConfigurationPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.DependencyInjection.Abstractions"        Version="$(MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.DependencyInjection"                     Version="$(MicrosoftExtensionsDependencyInjectionPackageVersion)" />
+    <Dependency Include="Microsoft.Extensions.DependencyModel"                         Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.DiagnosticAdapter"                       Version="$(MicrosoftExtensionsDiagnosticAdapterPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions"   Version="$(MicrosoftExtensionsDiagnosticsHealthChecksAbstractionsPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.Diagnostics.HealthChecks"                Version="$(MicrosoftExtensionsDiagnosticsHealthChecksPackageVersion)"  />
@@ -124,8 +140,24 @@
     <Dependency Include="Microsoft.Extensions.Options"                                 Version="$(MicrosoftExtensionsOptionsPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.Primitives"                              Version="$(MicrosoftExtensionsPrimitivesPackageVersion)" />
     <Dependency Include="Microsoft.Extensions.WebEncoders"                             Version="$(MicrosoftExtensionsWebEncodersPackageVersion)" />
+    <Dependency Include="Microsoft.IdentityModel.JsonWebTokens"                        Version="$(MicrosoftIdentityModelJsonWebTokensPackageVersion)" />
+    <Dependency Include="Microsoft.IdentityModel.Logging"                              Version="$(MicrosoftIdentityModelLoggingPackageVersion)" />
+    <Dependency Include="Microsoft.IdentityModel.Protocols.OpenIdConnect"              Version="$(MicrosoftIdentityModelProtocolsOpenIdConnectPackageVersion)" />
+    <Dependency Include="Microsoft.IdentityModel.Protocols"                            Version="$(MicrosoftIdentityModelProtocolsPackageVersion)" />
+    <Dependency Include="Microsoft.IdentityModel.Tokens"                               Version="$(MicrosoftIdentityModelTokensPackageVersion)" />
     <Dependency Include="Microsoft.Net.Http.Headers"                                   Version="$(MicrosoftNetHttpHeadersPackageVersion)" />
+    <Dependency Include="Newtonsoft.Json.Bson"                                         Version="$(NewtonsoftJsonBsonPackageVersion)" />
+    <Dependency Include="Newtonsoft.Json"                                              Version="$(NewtonsoftJsonPackageVersion)" />
+    <Dependency Include="System.IdentityModel.Tokens.Jwt"                              Version="$(SystemIdentityModelTokensJwtPackageVersion)" />
     <Dependency Include="System.IO.Pipelines"                                          Version="$(SystemIOPipelinesPackageVersion)" />
+    <Dependency Include="System.Net.WebSockets.WebSocketProtocol"                      Version="$(SystemNetWebSocketsWebSocketProtocolPackageVersion)" />
+    <Dependency Include="System.Runtime.CompilerServices.Unsafe"                       Version="$(SystemRuntimeCompilerServicesUnsafePackageVersion)" />
+    <Dependency Include="System.Security.Cryptography.Pkcs"                            Version="$(SystemSecurityCryptographyPkcsPackageVersion)" />
+    <Dependency Include="System.Security.Cryptography.Xml"                             Version="$(SystemSecurityCryptographyXmlPackageVersion)" />
+    <Dependency Include="System.Security.Permissions"                                  Version="$(SystemSecurityPermissionsPackageVersion)" />
+    <Dependency Include="System.Text.Encoding.CodePages"                               Version="$(SystemTextEncodingCodePagesPackageVersion)" />
+    <Dependency Include="System.Text.Encodings.Web"                                    Version="$(SystemTextEncodingsWebPackageVersion)" />
+    <Dependency Include="System.Threading.Channels"                                    Version="$(SystemThreadingChannelsPackageVersion)" />
   </ItemGroup>
 
 </Project>

+ 54 - 3
src/Framework/pkg/Metapackage.targets

@@ -21,7 +21,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <Content Include="$(IntermediateOutputPath)\runtime.json" PackagePath="\" />
+    <Content Include="$(IntermediateOutputPath)runtime.json" PackagePath="\" />
 
     <PackageReference Include="Microsoft.NETCore.App">
       <Version>$(MicrosoftNETCoreAppPackageVersion)</Version>
@@ -40,12 +40,22 @@
 
   <Import Project="$(RepositoryRoot)build\tasks\RepoTasks.tasks" />
 
-  <Target Name="GenerateRuntimeJson" BeforeTargets="BeforeBuild">
+  <Target Name="PrepareOutputPaths">
+    <MakeDir Directories="$(IntermediateOutputPath)" />
+  </Target>
+
+  <Target Name="GenerateRuntimeJson" BeforeTargets="BeforeBuild" DependsOnTargets="PrepareOutputPaths">
     <ItemGroup>
       <_SupportedRids Include="$(SupportedRuntimeIdentifiers)" />
     </ItemGroup>
 
     <PropertyGroup>
+      <!--
+        It's important to be careful about special characters in this property.
+          $  = %24
+          ;  = %3B
+          \n = %0A
+      -->
       <RuntimeJsonFileContent>
 {
   "runtimes": {
@@ -55,7 +65,42 @@
       </RuntimeJsonFileContent>
     </PropertyGroup>
 
-    <WriteLinesToFile Lines="$(RuntimeJsonFileContent)" File="$(IntermediateOutputPath)\runtime.json" Overwrite="true" />
+    <WriteLinesToFile Lines="$(RuntimeJsonFileContent)" File="$(IntermediateOutputPath)runtime.json" Overwrite="true" />
+  </Target>
+
+  <Target Name="GenerateBuildProps" BeforeTargets="BeforeBuild" DependsOnTargets="PrepareOutputPaths">
+
+    <ItemGroup>
+      <_AspNetAppPackageConflictOverrides Include="@(Dependency->'%(Identity)|%(Version)')" Condition=" '%(Dependency.Version)' != '' " />
+    </ItemGroup>
+
+    <PropertyGroup>
+      <!--
+        It's important to be careful about special characters in this property.
+          $  = %24
+          ;  = %3B
+          \n = %0A
+      -->
+      <BuildPropsContent>
+<![CDATA[
+<Project>
+  <ItemGroup Condition="'%24(RuntimeIdentifier)' == '' or '%24(SelfContained)' != 'true'">
+    <PackageConflictPlatformManifests Include="%24(MSBuildThisFileDirectory)Microsoft.AspNetCore.App.PlatformManifest.txt" />
+  </ItemGroup>
+
+  <ItemGroup Condition="'%24(DisableDefaultPackageConflictOverrides)' != 'true'">
+    <PackageConflictOverrides Include="Microsoft.AspNetCore.App">
+      <OverriddenPackages>
+        @(_AspNetAppPackageConflictOverrides, '%3B%0A        )%3B
+      </OverriddenPackages>
+    </PackageConflictOverrides>
+  </ItemGroup>
+</Project>
+]]>
+      </BuildPropsContent>
+    </PropertyGroup>
+
+    <WriteLinesToFile Lines="$(BuildPropsContent)" File="$(IntermediateOutputPath)Microsoft.AspNetCore.App.props" Overwrite="true" />
   </Target>
 
   <Target Name="ResolveReferenceItemsForPackage" DependsOnTargets="ResolveReferences" BeforeTargets="_GetPackageFiles">
@@ -63,6 +108,12 @@
       <Content Include="@(ReferencePath)" Condition="'%(ReferencePath.NuGetPackageId)' != 'Microsoft.NETCore.App'">
         <PackagePath>ref/$(TargetFramework)/%(ReferencePath.FileName)%(ReferencePath.Extension)</PackagePath>
       </Content>
+      <Content Include="%(_ResolvedFxProjects.ManifestOutputDir)\Microsoft.AspNetCore.App.PlatformManifest.txt">
+        <PackagePath>build/$(TargetFramework)/Microsoft.AspNetCore.App.PlatformManifest.txt</PackagePath>
+      </Content>
+      <Content Include="$(IntermediateOutputPath)Microsoft.AspNetCore.App.props">
+        <PackagePath>build/$(TargetFramework)/Microsoft.AspNetCore.App.props</PackagePath>
+      </Content>
     </ItemGroup>
   </Target>
 

+ 8 - 0
src/Framework/pkg/Microsoft.AspNetCore.App.pkgproj

@@ -23,6 +23,14 @@ This package requires the ASP.NET Core runtime. This runtime is installed by the
     <Content Include="_._" PackagePath="lib\$(TargetFramework)\" />
   </ItemGroup>
 
+  <ItemGroup>
+    <ProjectReference Include="..\src\Microsoft.AspNetCore.App.shfxproj">
+      <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+      <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
+      <OutputItemType>_ResolvedFxProjects</OutputItemType>
+    </ProjectReference>
+  </ItemGroup>
+
   <Import Project="..\Microsoft.AspNetCore.App.props" />
 
   <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

+ 10 - 5
src/Framework/src/SharedFx.targets

@@ -18,7 +18,7 @@ This targets file should only be imported by .shfxproj files.
       PrepareForPublish;
       ComputeAndCopyFilesToPublishDirectory;
       GeneratePublishDependencyFile;
-      GenerateSharedFxDependencyFile;
+      GenerateSharedFxMetadataFiles;
       GeneratePublishRuntimeConfigurationFile;
       CopySharedFxToOutput;
       CollectSharedFxOutput;
@@ -78,6 +78,7 @@ This targets file should only be imported by .shfxproj files.
     <!-- If symbols generation is disabled, there is no use in producing a symbols.nupkg files. -->
     <IncludeSymbols Condition="'$(CrossgenSymbolsOutput)' == 'false'">false</IncludeSymbols>
 
+    <ManifestOutputDir Condition="'$(ManifestOutputDir)' == ''">$(OutputPath)manifest\</ManifestOutputDir>
     <MetadataOutputPath Condition="'$(MetadataOutputPath)' == ''">$(OutputPath)files\</MetadataOutputPath>
     <SymbolsOutputPath Condition="'$(SymbolsOutputPath)' == ''">$(OutputPath)symbols\</SymbolsOutputPath>
     <NativeAssetsOutputPath Condition="'$(NativeAssetsOutputPath)' == ''">$(OutputPath)native\</NativeAssetsOutputPath>
@@ -99,6 +100,7 @@ This targets file should only be imported by .shfxproj files.
     <ProjectRuntimeConfigFilePath>$(PublishRuntimeConfigFilePath)</ProjectRuntimeConfigFilePath>
     <SharedFxDepsFilePath>$(MetadataOutputPath)$(SharedFxName).deps.json</SharedFxDepsFilePath>
     <VersionFileOutputPath>$(MetadataOutputPath).version</VersionFileOutputPath>
+    <PlatformManifestOutputPath>$(ManifestOutputDir)$(SharedFxName).PlatformManifest.txt</PlatformManifestOutputPath>
   </PropertyGroup>
 
   <ItemDefinitionGroup>
@@ -115,6 +117,8 @@ This targets file should only be imported by .shfxproj files.
       <MetadataOutputPath>$(MetadataOutputPath)</MetadataOutputPath>
       <RuntimeAssetsOutputPath>$(RuntimeAssetsOutputPath)</RuntimeAssetsOutputPath>
       <NativeAssetsOutputPath>$(NativeAssetsOutputPath)</NativeAssetsOutputPath>
+      <!-- Don't include the platform manifest in installer assets. -->
+      <ManifestOutputDir>$(ManifestOutputDir)</ManifestOutputDir>
       <SharedFxName>$(SharedFxName)</SharedFxName>
       <PackageId>$(PackageId)</PackageId>
     </TargetPathWithTargetPlatformMoniker>
@@ -170,17 +174,18 @@ This targets file should only be imported by .shfxproj files.
       Overwrite="true" />
   </Target>
 
-  <!-- Generates the .deps.json file for a shared framework. -->
-  <Target Name="GenerateSharedFxDependencyFile"
+  <!-- Generates the .deps.json and PlatformManifest.txt files for a shared framework. -->
+  <Target Name="GenerateSharedFxMetadataFiles"
           Inputs="$(PublishDepsFilePath);$(ProjectAssetsFile);$(MSBuildAllProjects)"
           Outputs="$(SharedFxDepsFilePath)">
-    <ProcessSharedFrameworkDeps
+    <GenerateSharedFrameworkMetadataFiles
       FrameworkName="$(SharedFxName)"
       FrameworkVersion="$(SharedFxVersion)"
       AssetsFilePath="$(ProjectAssetsFile)"
       TargetFramework="$(TargetFramework)"
       DepsFilePath="$(PublishDepsFilePath)"
-      OutputPath="$(SharedFxDepsFilePath)"
+      DepsFileOutputPath="$(SharedFxDepsFilePath)"
+      PlatformManifestOutputPath="$(PlatformManifestOutputPath)"
       BaseRuntimeIdentifier="$(BaseSharedFxRid)" />
   </Target>
 

+ 14 - 2
src/Framework/test/Microsoft.AspNetCore.App.UnitTests.csproj

@@ -6,6 +6,8 @@
     <IsPackable>false</IsPackable>
   </PropertyGroup>
 
+  <Import Project="..\Microsoft.AspNetCore.App.props" />
+
   <ItemGroup>
     <AssemblyAttribute Include="Microsoft.AspNetCore.TestData">
       <_Parameter1>PackageVersion</_Parameter1>
@@ -38,10 +40,20 @@
 
   <Target Name="GenerateTestData" BeforeTargets="GetAssemblyAttributes" DependsOnTargets="ResolveProjectReferences">
     <ItemGroup>
-      <AssemblyAttribute Include="Microsoft.AspNetCore.TestData" Condition="'%(_ResolvedFrameworkReference.Identity)' != ''">
-        <_Parameter1>SharedFxMetadataOutput:%(_ResolvedFrameworkReference.SharedFxName)</_Parameter1>
+      <ExpectedAssemblyNames Include="%(Dependency.AssemblyName)" />
+      <ExpectedAssemblyNames Include="@(Dependency)" Condition="'%(Dependency.AssemblyName)' == '' " />
+      <AssemblyAttribute Include="Microsoft.AspNetCore.TestData">
+        <_Parameter1>SharedFxDependencies</_Parameter1>
+        <_Parameter2>@(ExpectedAssemblyNames)</_Parameter2>
+      </AssemblyAttribute>
+      <AssemblyAttribute Include="Microsoft.AspNetCore.TestData">
+        <_Parameter1>MetadataOutputPath</_Parameter1>
         <_Parameter2>%(_ResolvedFrameworkReference.MetadataOutputPath)</_Parameter2>
       </AssemblyAttribute>
+      <AssemblyAttribute Include="Microsoft.AspNetCore.TestData">
+        <_Parameter1>ManifestOutputDir</_Parameter1>
+        <_Parameter2>%(_ResolvedFrameworkReference.ManifestOutputDir)</_Parameter2>
+      </AssemblyAttribute>
     </ItemGroup>
   </Target>
 

+ 77 - 15
src/Framework/test/SharedFxTests.cs

@@ -1,29 +1,94 @@
 // Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
+using System;
+using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using Newtonsoft.Json.Linq;
 using Xunit;
+using Xunit.Abstractions;
 
 namespace Microsoft.AspNetCore
 {
     public class SharedFxTests
     {
         private readonly string _expectedTfm;
+        private readonly string _expectedRid;
+        private readonly ITestOutputHelper _output;
 
-        public SharedFxTests()
+        public SharedFxTests(ITestOutputHelper output)
         {
+            _output = output;
             _expectedTfm = "netcoreapp" + TestData.GetPackageVersion().Substring(0, 3);
+            _expectedRid = TestData.GetSharedFxRuntimeIdentifier();
+        }
+
+        [Fact]
+        public void PlatformManifestListsAllFiles()
+        {
+            var platformManifestPath = Path.Combine(TestData.GetManifestOutputDir(), "Microsoft.AspNetCore.App.PlatformManifest.txt");
+            var expectedAssemblies = TestData.GetSharedFxDependencies()
+                .Split(';', StringSplitOptions.RemoveEmptyEntries)
+                .ToHashSet();
+
+            _output.WriteLine("==== file contents ====");
+            _output.WriteLine(File.ReadAllText(platformManifestPath));
+            _output.WriteLine("==== expected assemblies ====");
+            _output.WriteLine(string.Join('\n', expectedAssemblies));
+
+            AssertEx.FileExists(platformManifestPath);
+
+            var manifestFileLines = File.ReadAllLines(platformManifestPath);
+
+            var actualAssemblies = manifestFileLines
+                .Where(s => !string.IsNullOrEmpty(s))
+                .Select(i =>
+                {
+                    var fileName = i.Split('|')[0];
+                    return fileName.EndsWith(".dll", StringComparison.Ordinal)
+                        ? fileName.Substring(0, fileName.Length - 4)
+                        : fileName;
+                })
+                .ToHashSet();
+
+            var missing = expectedAssemblies.Except(actualAssemblies);
+            var unexpected = actualAssemblies.Except(expectedAssemblies)
+                .Where(s => !string.Equals(s, "aspnetcorev2_inprocess", StringComparison.Ordinal)); // this native assembly only appears in Windows builds.
+
+            if (_expectedRid.StartsWith("win", StringComparison.Ordinal) && !_expectedRid.Contains("arm"))
+            {
+                Assert.Contains("aspnetcorev2_inprocess", actualAssemblies);
+            }
+
+            _output.WriteLine("==== missing assemblies from the manifest ====");
+            _output.WriteLine(string.Join('\n', missing));
+            _output.WriteLine("==== unexpected assemblies in the manifest ====");
+            _output.WriteLine(string.Join('\n', unexpected));
+
+            Assert.Empty(missing);
+            Assert.Empty(unexpected);
+
+            Assert.All(manifestFileLines, line =>
+            {
+                var parts = line.Split('|');
+                Assert.Equal(4, parts.Length);
+                Assert.Equal("Microsoft.AspNetCore.App", parts[1]);
+                if (parts[2].Length > 0)
+                {
+                    Assert.True(Version.TryParse(parts[2], out _), "Assembly version must be convertable to System.Version");
+                }
+                Assert.True(Version.TryParse(parts[3], out _), "File version must be convertable to System.Version");
+            });
         }
 
         [Fact]
         public void ItContainsValidRuntimeConfigFile()
         {
-            var runtimeConfigFilePath = Path.Combine(GetMetadataOutput(), "Microsoft.AspNetCore.App.runtimeconfig.json");
+            var runtimeConfigFilePath = Path.Combine(TestData.GetMetadataOutput(), "Microsoft.AspNetCore.App.runtimeconfig.json");
 
             AssertEx.FileExists(runtimeConfigFilePath);
-            AssertEx.FileDoesNotExists(Path.Combine(GetMetadataOutput(), "Microsoft.AspNetCore.App.runtimeconfig.dev.json"));
+            AssertEx.FileDoesNotExists(Path.Combine(TestData.GetMetadataOutput(), "Microsoft.AspNetCore.App.runtimeconfig.dev.json"));
 
             var runtimeConfig = JObject.Parse(File.ReadAllText(runtimeConfigFilePath));
 
@@ -36,11 +101,10 @@ namespace Microsoft.AspNetCore
         [Fact]
         public void ItContainsValidDepsJson()
         {
-            var depsFilePath = Path.Combine(GetMetadataOutput(), "Microsoft.AspNetCore.App.deps.json");
-            var rid = TestData.GetSharedFxRuntimeIdentifier();
+            var depsFilePath = Path.Combine(TestData.GetMetadataOutput(), "Microsoft.AspNetCore.App.deps.json");
 
-            var target = $".NETCoreApp,Version=v{TestData.GetPackageVersion().Substring(0, 3)}/{rid}";
-            var ridPackageId = $"runtime.{rid}.Microsoft.AspNetCore.App";
+            var target = $".NETCoreApp,Version=v{TestData.GetPackageVersion().Substring(0, 3)}/{_expectedRid}";
+            var ridPackageId = $"runtime.{_expectedRid}.Microsoft.AspNetCore.App";
 
             AssertEx.FileExists(depsFilePath);
 
@@ -49,7 +113,7 @@ namespace Microsoft.AspNetCore
             Assert.Equal(target, (string)depsFile["runtimeTarget"]["name"]);
             Assert.NotNull(depsFile["compilationOptions"]);
             Assert.Empty(depsFile["compilationOptions"]);
-            Assert.NotEmpty(depsFile["runtimes"][rid]);
+            Assert.NotEmpty(depsFile["runtimes"][_expectedRid]);
             Assert.All(depsFile["libraries"], item =>
             {
                 var prop = Assert.IsType<JProperty>(item);
@@ -59,7 +123,7 @@ namespace Microsoft.AspNetCore
             });
 
             Assert.NotNull(depsFile["libraries"][$"Microsoft.AspNetCore.App/{TestData.GetPackageVersion()}"]);
-            Assert.NotNull(depsFile["libraries"][$"runtime.{rid}.Microsoft.AspNetCore.App/{TestData.GetPackageVersion()}"]);
+            Assert.NotNull(depsFile["libraries"][$"runtime.{_expectedRid}.Microsoft.AspNetCore.App/{TestData.GetPackageVersion()}"]);
             Assert.Equal(2, depsFile["libraries"].Values().Count());
 
             var targetLibraries = depsFile["targets"][target];
@@ -73,17 +137,17 @@ namespace Microsoft.AspNetCore
             Assert.All(runtimeLibrary["runtime"], item =>
             {
                 var obj = Assert.IsType<JProperty>(item);
-                Assert.StartsWith($"runtimes/{rid}/lib/{_expectedTfm}/", obj.Name);
+                Assert.StartsWith($"runtimes/{_expectedRid}/lib/{_expectedTfm}/", obj.Name);
                 Assert.NotEmpty(obj.Value["assemblyVersion"].Value<string>());
                 Assert.NotEmpty(obj.Value["fileVersion"].Value<string>());
             });
 
-            if (TestData.GetSharedFxRuntimeIdentifier().StartsWith("win"))
+            if (_expectedRid.StartsWith("win"))
             {
                 Assert.All(runtimeLibrary["native"], item =>
                 {
                     var obj = Assert.IsType<JProperty>(item);
-                    Assert.StartsWith($"runtimes/{rid}/native/", obj.Name);
+                    Assert.StartsWith($"runtimes/{_expectedRid}/native/", obj.Name);
                 });
             }
             else
@@ -95,14 +159,12 @@ namespace Microsoft.AspNetCore
         [Fact]
         public void ItContainsVersionFile()
         {
-            var versionFile = Path.Combine(GetMetadataOutput(), ".version");
+            var versionFile = Path.Combine(TestData.GetMetadataOutput(), ".version");
             AssertEx.FileExists(versionFile);
             var lines = File.ReadAllLines(versionFile);
             Assert.Equal(2, lines.Length);
             Assert.Equal(TestData.GetRepositoryCommit(), lines[0]);
             Assert.Equal(TestData.GetPackageVersion(), lines[1]);
         }
-
-        private string GetMetadataOutput() => TestData.GetTestDataValue("SharedFxMetadataOutput:Microsoft.AspNetCore.App");
     }
 }

+ 6 - 0
src/Framework/test/TestData.cs

@@ -16,6 +16,12 @@ namespace Microsoft.AspNetCore
 
         public static string GetSharedFxRuntimeIdentifier() => GetTestDataValue("SharedFxRid");
 
+        public static string GetSharedFxDependencies() => GetTestDataValue("SharedFxDependencies");
+
+        public static string GetMetadataOutput() => GetTestDataValue("MetadataOutputPath");
+
+        public static string GetManifestOutputDir() => GetTestDataValue("ManifestOutputDir");
+
         public static string GetTestDataValue(string key)
              => typeof(TestData).Assembly.GetCustomAttributes<TestDataAttribute>().Single(d => d.Key == key).Value;
     }