Browse Source

[Blazor] Pins the SDK version to 3.1 and forces Blazor projects to compile against it (#17479)

Javier Calvarro Nelson 6 years ago
parent
commit
e3dcd41304

+ 1 - 0
NuGet.config

@@ -13,6 +13,7 @@
     <add key="darc-pub-aspnet-Extensions-4ebd75b" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-aspnet-Extensions-4ebd75b9/nuget/v3/index.json" />
     <add key="aspnet-entityframeworkcore" value="https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json" />
     <add key="aspnet-aspnetcore-tooling" value="https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json" />
+    <add key="aspnet-stable" value="https://dotnetfeed.blob.core.windows.net/dotnet-core-3-1-rtm-014727/index.json" />
     <add key="grpc-nuget-dev" value="https://grpc.jfrog.io/grpc/api/nuget/v3/grpc-nuget-dev" />
     <add key="roslyn" value="https://dotnet.myget.org/F/roslyn/api/v3/index.json" />
     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />

+ 1 - 1
eng/ProjectReferences.props

@@ -17,6 +17,7 @@
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor.Build" ProjectPath="$(RepoRoot)src\Components\Blazor\Build\src\Microsoft.AspNetCore.Blazor.Build.csproj"  />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor.HttpClient" ProjectPath="$(RepoRoot)src\Components\Blazor\Http\src\Microsoft.AspNetCore.Blazor.HttpClient.csproj"  />
     <ProjectReferenceProvider Include="Mono.WebAssembly.Interop" ProjectPath="$(RepoRoot)src\Components\Blazor\Mono.WebAssembly.Interop\src\Mono.WebAssembly.Interop.csproj"  />
+    <ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor.Server" ProjectPath="$(RepoRoot)src\Components\Blazor\Server\src\Microsoft.AspNetCore.Blazor.Server.csproj"  />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor.DataAnnotations.Validation" ProjectPath="$(RepoRoot)src\Components\Blazor\Validation\src\Microsoft.AspNetCore.Blazor.DataAnnotations.Validation.csproj"  />
     <ProjectReferenceProvider Include="Ignitor" ProjectPath="$(RepoRoot)src\Components\Ignitor\src\Ignitor.csproj"  />
     <ProjectReferenceProvider Include="BlazorServerApp" ProjectPath="$(RepoRoot)src\Components\Samples\BlazorServerApp\BlazorServerApp.csproj"  />
@@ -138,7 +139,6 @@
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.SignalR.StackExchangeRedis" ProjectPath="$(RepoRoot)src\SignalR\server\StackExchangeRedis\src\Microsoft.AspNetCore.SignalR.StackExchangeRedis.csproj" RefProjectPath="$(RepoRoot)src\SignalR\server\StackExchangeRedis\ref\Microsoft.AspNetCore.SignalR.StackExchangeRedis.csproj" />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Components.Authorization" ProjectPath="$(RepoRoot)src\Components\Authorization\src\Microsoft.AspNetCore.Components.Authorization.csproj" RefProjectPath="$(RepoRoot)src\Components\Authorization\ref\Microsoft.AspNetCore.Components.Authorization.csproj" />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor" ProjectPath="$(RepoRoot)src\Components\Blazor\Blazor\src\Microsoft.AspNetCore.Blazor.csproj" RefProjectPath="$(RepoRoot)src\Components\Blazor\Blazor\ref\Microsoft.AspNetCore.Blazor.csproj" />
-    <ProjectReferenceProvider Include="Microsoft.AspNetCore.Blazor.Server" ProjectPath="$(RepoRoot)src\Components\Blazor\Server\src\Microsoft.AspNetCore.Blazor.Server.csproj" RefProjectPath="$(RepoRoot)src\Components\Blazor\Server\ref\Microsoft.AspNetCore.Blazor.Server.csproj" />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Components" ProjectPath="$(RepoRoot)src\Components\Components\src\Microsoft.AspNetCore.Components.csproj" RefProjectPath="$(RepoRoot)src\Components\Components\ref\Microsoft.AspNetCore.Components.csproj" />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Components.Forms" ProjectPath="$(RepoRoot)src\Components\Forms\src\Microsoft.AspNetCore.Components.Forms.csproj" RefProjectPath="$(RepoRoot)src\Components\Forms\ref\Microsoft.AspNetCore.Components.Forms.csproj" />
     <ProjectReferenceProvider Include="Microsoft.AspNetCore.Components.Server" ProjectPath="$(RepoRoot)src\Components\Server\src\Microsoft.AspNetCore.Components.Server.csproj" RefProjectPath="$(RepoRoot)src\Components\Server\ref\Microsoft.AspNetCore.Components.Server.csproj" />

+ 20 - 20
eng/Version.Details.xml

@@ -29,33 +29,33 @@
       <Uri>https://github.com/aspnet/AspNetCore-Tooling</Uri>
       <Sha>abd3c17b317dbe455b18a4f5937c43e0fc7a2944</Sha>
     </Dependency>
-    <Dependency Name="dotnet-ef" Version="3.1.0-rtm.19573.1">
+    <Dependency Name="dotnet-ef" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
-      <Sha>a2f33c7d5125c6f3b671e55eb1bc58489041ad01</Sha>
+      <Sha>82c6ea483d3a17393dad5986df9a8eef89ddcd07</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.0-rtm.19573.1">
+    <Dependency Name="Microsoft.EntityFrameworkCore.InMemory" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
-      <Sha>a2f33c7d5125c6f3b671e55eb1bc58489041ad01</Sha>
+      <Sha>82c6ea483d3a17393dad5986df9a8eef89ddcd07</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0-rtm.19573.1">
+    <Dependency Name="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
-      <Sha>a2f33c7d5125c6f3b671e55eb1bc58489041ad01</Sha>
+      <Sha>82c6ea483d3a17393dad5986df9a8eef89ddcd07</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0-rtm.19573.1">
+    <Dependency Name="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
-      <Sha>a2f33c7d5125c6f3b671e55eb1bc58489041ad01</Sha>
+      <Sha>82c6ea483d3a17393dad5986df9a8eef89ddcd07</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0-rtm.19573.1">
+    <Dependency Name="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
-      <Sha>a2f33c7d5125c6f3b671e55eb1bc58489041ad01</Sha>
+      <Sha>82c6ea483d3a17393dad5986df9a8eef89ddcd07</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0-rtm.19573.1">
+    <Dependency Name="Microsoft.EntityFrameworkCore.Tools" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
-      <Sha>a2f33c7d5125c6f3b671e55eb1bc58489041ad01</Sha>
+      <Sha>82c6ea483d3a17393dad5986df9a8eef89ddcd07</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.EntityFrameworkCore" Version="3.1.0-rtm.19573.1">
+    <Dependency Name="Microsoft.EntityFrameworkCore" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/aspnet/EntityFrameworkCore</Uri>
-      <Sha>a2f33c7d5125c6f3b671e55eb1bc58489041ad01</Sha>
+      <Sha>82c6ea483d3a17393dad5986df9a8eef89ddcd07</Sha>
     </Dependency>
     <Dependency Name="Microsoft.AspNetCore.Analyzer.Testing" Version="3.1.0-rtm.19572.8" CoherentParentDependency="Microsoft.EntityFrameworkCore">
       <Uri>https://github.com/aspnet/Extensions</Uri>
@@ -381,21 +381,21 @@
       <Uri>https://github.com/dotnet/corefx</Uri>
       <Sha>0f7f38c4fd323b26da10cce95f857f77f0f09b48</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.Extensions.DependencyModel" Version="3.1.1-servicing.19572.8" CoherentParentDependency="Microsoft.Extensions.Logging">
+    <Dependency Name="Microsoft.Extensions.DependencyModel" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/dotnet/core-setup</Uri>
-      <Sha>9541fa09c354ea9288db00b8c1b95a34a3abdcdc</Sha>
+      <Sha>65f04fb6db7a5e198d05dbebd5c4ad21eb018f89</Sha>
     </Dependency>
-    <Dependency Name="Microsoft.NETCore.App.Ref" Version="3.1.1-servicing.19572.8" CoherentParentDependency="Microsoft.Extensions.Logging">
+    <Dependency Name="Microsoft.NETCore.App.Ref" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/dotnet/core-setup</Uri>
-      <Sha>9541fa09c354ea9288db00b8c1b95a34a3abdcdc</Sha>
+      <Sha>65f04fb6db7a5e198d05dbebd5c4ad21eb018f89</Sha>
     </Dependency>
     <!--
          Win-x64 is used here because we have picked an arbitrary runtime identifier to flow the version of the latest NETCore.App runtime.
          All Runtime.$rid packages should have the same version.
     -->
-    <Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="3.1.1-servicing.19572.8" CoherentParentDependency="Microsoft.Extensions.Logging">
+    <Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="3.1.0" Pinned="true">
       <Uri>https://github.com/dotnet/core-setup</Uri>
-      <Sha>9541fa09c354ea9288db00b8c1b95a34a3abdcdc</Sha>
+      <Sha>65f04fb6db7a5e198d05dbebd5c4ad21eb018f89</Sha>
     </Dependency>
     <Dependency Name="NETStandard.Library.Ref" Version="2.1.0" Pinned="true">
       <Uri>https://github.com/dotnet/core-setup</Uri>

+ 10 - 10
eng/Versions.props

@@ -66,9 +66,9 @@
     <!-- Packages from dotnet/roslyn -->
     <MicrosoftNetCompilersToolsetPackageVersion>3.4.0-beta4-19569-03</MicrosoftNetCompilersToolsetPackageVersion>
     <!-- Packages from dotnet/core-setup -->
-    <MicrosoftExtensionsDependencyModelPackageVersion>3.1.1-servicing.19572.8</MicrosoftExtensionsDependencyModelPackageVersion>
-    <MicrosoftNETCoreAppRefPackageVersion>3.1.1-servicing.19572.8</MicrosoftNETCoreAppRefPackageVersion>
-    <MicrosoftNETCoreAppRuntimewinx64PackageVersion>3.1.1-servicing.19572.8</MicrosoftNETCoreAppRuntimewinx64PackageVersion>
+    <MicrosoftExtensionsDependencyModelPackageVersion>3.1.0</MicrosoftExtensionsDependencyModelPackageVersion>
+    <MicrosoftNETCoreAppRefPackageVersion>3.1.0</MicrosoftNETCoreAppRefPackageVersion>
+    <MicrosoftNETCoreAppRuntimewinx64PackageVersion>3.1.0</MicrosoftNETCoreAppRuntimewinx64PackageVersion>
     <NETStandardLibraryRefPackageVersion>2.1.0</NETStandardLibraryRefPackageVersion>
     <!-- Packages from dotnet/corefx -->
     <MicrosoftBclAsyncInterfacesPackageVersion>1.1.0</MicrosoftBclAsyncInterfacesPackageVersion>
@@ -160,13 +160,13 @@
     <MicrosoftJSInteropPackageVersion>3.1.0</MicrosoftJSInteropPackageVersion>
     <MonoWebAssemblyInteropPackageVersion>3.1.0-preview4.19572.8</MonoWebAssemblyInteropPackageVersion>
     <!-- Packages from aspnet/EntityFrameworkCore -->
-    <dotnetefPackageVersion>3.1.0-rtm.19573.1</dotnetefPackageVersion>
-    <MicrosoftEntityFrameworkCoreInMemoryPackageVersion>3.1.0-rtm.19573.1</MicrosoftEntityFrameworkCoreInMemoryPackageVersion>
-    <MicrosoftEntityFrameworkCoreRelationalPackageVersion>3.1.0-rtm.19573.1</MicrosoftEntityFrameworkCoreRelationalPackageVersion>
-    <MicrosoftEntityFrameworkCoreSqlitePackageVersion>3.1.0-rtm.19573.1</MicrosoftEntityFrameworkCoreSqlitePackageVersion>
-    <MicrosoftEntityFrameworkCoreSqlServerPackageVersion>3.1.0-rtm.19573.1</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
-    <MicrosoftEntityFrameworkCoreToolsPackageVersion>3.1.0-rtm.19573.1</MicrosoftEntityFrameworkCoreToolsPackageVersion>
-    <MicrosoftEntityFrameworkCorePackageVersion>3.1.0-rtm.19573.1</MicrosoftEntityFrameworkCorePackageVersion>
+    <dotnetefPackageVersion>3.1.0</dotnetefPackageVersion>
+    <MicrosoftEntityFrameworkCoreInMemoryPackageVersion>3.1.0</MicrosoftEntityFrameworkCoreInMemoryPackageVersion>
+    <MicrosoftEntityFrameworkCoreRelationalPackageVersion>3.1.0</MicrosoftEntityFrameworkCoreRelationalPackageVersion>
+    <MicrosoftEntityFrameworkCoreSqlitePackageVersion>3.1.0</MicrosoftEntityFrameworkCoreSqlitePackageVersion>
+    <MicrosoftEntityFrameworkCoreSqlServerPackageVersion>3.1.0</MicrosoftEntityFrameworkCoreSqlServerPackageVersion>
+    <MicrosoftEntityFrameworkCoreToolsPackageVersion>3.1.0</MicrosoftEntityFrameworkCoreToolsPackageVersion>
+    <MicrosoftEntityFrameworkCorePackageVersion>3.1.0</MicrosoftEntityFrameworkCorePackageVersion>
     <!-- Packages from aspnet/AspNetCore-Tooling -->
     <MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>3.1.0-rtm.19573.1</MicrosoftAspNetCoreMvcRazorExtensionsPackageVersion>
     <MicrosoftAspNetCoreRazorLanguagePackageVersion>3.1.0-rtm.19573.1</MicrosoftAspNetCoreRazorLanguagePackageVersion>

+ 2 - 2
global.json

@@ -1,9 +1,9 @@
 {
   "sdk": {
-    "version": "3.1.100-preview1-014400"
+    "version": "3.1.100"
   },
   "tools": {
-    "dotnet": "3.1.100-preview1-014400",
+    "dotnet": "3.1.100",
     "runtimes": {
       "dotnet/x64": [
         "$(MicrosoftNETCoreAppRuntimeVersion)"

+ 1 - 0
src/Components/Blazor/Build/testassets/blazorhosted/blazorhosted.csproj

@@ -2,6 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netcoreapp3.1</TargetFramework>
+    <DisableImplicitComponentsAnalyzers>true</DisableImplicitComponentsAnalyzers>
   </PropertyGroup>
 
   <ItemGroup>

+ 3 - 4
src/Components/Blazor/DevServer/src/Microsoft.AspNetCore.Blazor.DevServer.csproj

@@ -11,15 +11,14 @@
     <Description>Development server for use when building Blazor applications.</Description>
     <!-- Set this to false because assemblies should not reference this assembly directly, (except for tests, of course). -->
     <IsProjectReferenceProvider>false</IsProjectReferenceProvider>
+
+    <!-- This is so that we add the FrameworkReference to Microsoft.AspNetCore.App -->
+    <UseLatestAspNetCoreReference>true</UseLatestAspNetCoreReference>
   </PropertyGroup>
 
   <ItemGroup>
     <Reference Include="Microsoft.AspNetCore.Blazor.Server" />
-    <Reference Include="Microsoft.AspNetCore.Components.Server" />
-    <Reference Include="Microsoft.AspNetCore.ResponseCompression" />
-    <Reference Include="Microsoft.AspNetCore" />
     <Reference Include="Microsoft.Extensions.CommandLineUtils.Sources" />
-    <Reference Include="Microsoft.Extensions.Hosting" />
   </ItemGroup>
 
   <!-- Pack settings -->

+ 4 - 1
src/Components/Blazor/Directory.Build.props

@@ -6,5 +6,8 @@
     <VersionPrefix>3.1.0</VersionPrefix>
     <PreReleaseVersionLabel>preview4</PreReleaseVersionLabel>
     <DotNetFinalVersionKind />
+    <!-- This property points to the latest released Microsoft.AspNetCore.App version it needs to be updated to
+         target the latest patch before a preview release. -->
+    <LatestAspNetCoreReferenceVersion>3.1.0</LatestAspNetCoreReferenceVersion>
   </PropertyGroup>
-</Project>
+</Project>

+ 1 - 0
src/Components/Blazor/Directory.Build.targets

@@ -4,4 +4,5 @@
   <PropertyGroup>
     <ComponentsPackageVersion>$(PackageVersion)</ComponentsPackageVersion>
   </PropertyGroup>
+
 </Project>

+ 0 - 16
src/Components/Blazor/Server/ref/Microsoft.AspNetCore.Blazor.Server.csproj

@@ -1,16 +0,0 @@
-<!-- This file is automatically generated. -->
-<Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFrameworks>$(DefaultNetCoreTargetFramework)</TargetFrameworks>
-  </PropertyGroup>
-  <ItemGroup Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">
-    <Compile Include="Microsoft.AspNetCore.Blazor.Server.netcoreapp.cs" />
-    <Reference Include="Microsoft.AspNetCore.Hosting.Abstractions"  />
-    <Reference Include="Microsoft.AspNetCore.SpaServices.Extensions"  />
-    <Reference Include="Microsoft.AspNetCore.StaticFiles"  />
-    <Reference Include="Microsoft.AspNetCore.WebSockets"  />
-    <Reference Include="Microsoft.Extensions.FileProviders.Embedded"  />
-    <Reference Include="Newtonsoft.Json"  />
-    <Reference Include="Mono.Cecil"  />
-  </ItemGroup>
-</Project>

+ 0 - 22
src/Components/Blazor/Server/ref/Microsoft.AspNetCore.Blazor.Server.netcoreapp.cs

@@ -1,22 +0,0 @@
-// 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.
-
-namespace Microsoft.AspNetCore.Builder
-{
-    public static partial class BlazorHostingApplicationBuilderExtensions
-    {
-        public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseClientSideBlazorFiles(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, string clientAssemblyFilePath) { throw null; }
-        public static Microsoft.AspNetCore.Builder.IApplicationBuilder UseClientSideBlazorFiles<TClientApp>(this Microsoft.AspNetCore.Builder.IApplicationBuilder app) { throw null; }
-    }
-    public static partial class BlazorHostingEndpointRouteBuilderExtensions
-    {
-        public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToClientSideBlazor(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string clientAssemblyFilePath, string filePath) { throw null; }
-        public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToClientSideBlazor(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string clientAssemblyFilePath, string pattern, string filePath) { throw null; }
-        public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToClientSideBlazor<TClientApp>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string filePath) { throw null; }
-        public static Microsoft.AspNetCore.Builder.IEndpointConventionBuilder MapFallbackToClientSideBlazor<TClientApp>(this Microsoft.AspNetCore.Routing.IEndpointRouteBuilder endpoints, string pattern, string filePath) { throw null; }
-    }
-    public static partial class BlazorMonoDebugProxyAppBuilderExtensions
-    {
-        public static void UseBlazorDebugging(this Microsoft.AspNetCore.Builder.IApplicationBuilder app) { }
-    }
-}

+ 3 - 5
src/Components/Blazor/Server/src/Microsoft.AspNetCore.Blazor.Server.csproj

@@ -4,6 +4,9 @@
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <Description>Runtime server features for ASP.NET Core Blazor applications.</Description>
     <IsShippingPackage>true</IsShippingPackage>
+    <HasReferenceAssembly>false</HasReferenceAssembly>
+    <!-- This is so that we add the FrameworkReference to Microsoft.AspNetCore.App -->
+    <UseLatestAspNetCoreReference>true</UseLatestAspNetCoreReference>
   </PropertyGroup>
 
   <ItemGroup>
@@ -11,11 +14,6 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Reference Include="Microsoft.AspNetCore.Hosting.Abstractions" />
-    <Reference Include="Microsoft.AspNetCore.SpaServices.Extensions" />
-    <Reference Include="Microsoft.AspNetCore.StaticFiles" />
-    <Reference Include="Microsoft.AspNetCore.WebSockets" />
-    <Reference Include="Microsoft.Extensions.FileProviders.Embedded" />
     <Reference Include="Newtonsoft.Json" />
 
     <!-- Used by ws-proxy sources only. Remove this once we're able to consume ws-proxy as a NuGet package. -->

+ 3 - 2
src/Components/Blazor/testassets/HostedInAspNet.Server/HostedInAspNet.Server.csproj

@@ -2,6 +2,9 @@
 
   <PropertyGroup>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
+    <!-- This is so that we add the FrameworkReference to Microsoft.AspNetCore.App -->
+    <UseLatestAspNetCoreReference>true</UseLatestAspNetCoreReference>
+
   </PropertyGroup>
 
   <ItemGroup>
@@ -10,8 +13,6 @@
 
   <ItemGroup>
     <Reference Include="Microsoft.AspNetCore.Blazor.Server" />
-    <Reference Include="Microsoft.AspNetCore" />
-    <Reference Include="Microsoft.Extensions.Hosting" />
   </ItemGroup>
 
 </Project>

+ 2 - 2
src/Components/Blazor/testassets/MonoSanity/MonoSanity.csproj

@@ -2,6 +2,8 @@
 
   <PropertyGroup>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
+    <!-- This is so that we add the FrameworkReference to Microsoft.AspNetCore.App -->
+    <UseLatestAspNetCoreReference>true</UseLatestAspNetCoreReference>
   </PropertyGroup>
 
   <ItemGroup>
@@ -9,9 +11,7 @@
   </ItemGroup>
 
   <ItemGroup>
-    <Reference Include="Microsoft.AspNetCore" />
     <Reference Include="Microsoft.AspNetCore.Blazor.Server" />
-    <Reference Include="Microsoft.Extensions.Hosting" />
   </ItemGroup>
 
 </Project>

+ 4 - 0
src/Components/Directory.Build.props

@@ -12,6 +12,10 @@
   <PropertyGroup>
     <PackageTags>aspnetcore;components</PackageTags>
 
+    <!-- This property points to the latest released Microsoft.AspNetCore.App version it needs to be updated to
+         target the latest patch before a preview release. -->
+    <LatestAspNetCoreReferenceVersion>3.1.0</LatestAspNetCoreReferenceVersion>
+
     <ComponentsSharedSourceRoot>$(MSBuildThisFileDirectory)Shared\</ComponentsSharedSourceRoot>
 
     <!-- So we can use the tool from source within the repo without having to pack -->

+ 20 - 0
src/Components/Directory.Build.targets

@@ -3,6 +3,26 @@
     <GenerateDocumentationFile Condition="'$(GenerateDocumentationFile)' == ''">true</GenerateDocumentationFile>
   </PropertyGroup>
 
+  <!-- We need to do this because our build config interferes with the FrameworkReference definition.
+       This is a way to add the framework defition to the projects that need it (like Blazor Server and
+       Blazor Dev Server) -->
+  <Target Name="_AddAspNetCoreFrameworkReference" BeforeTargets="ProcessFrameworkReferences" Condition="'$(UseLatestAspNetCoreReference)' == 'true' ">
+    <ItemGroup>
+      <FrameworkReference Include="Microsoft.AspNetCore.App" Version="$(LatestAspNetCoreReferenceVersion)" />
+      <KnownFrameworkReference Include="Microsoft.AspNetCore.App">
+        <TargetFramework>netcoreapp3.1</TargetFramework>
+        <RuntimeFrameworkName>Microsoft.AspNetCore.App</RuntimeFrameworkName>
+        <DefaultRuntimeFrameworkVersion>$(LatestAspNetCoreReferenceVersion)</DefaultRuntimeFrameworkVersion>
+        <LatestRuntimeFrameworkVersion>$(LatestAspNetCoreReferenceVersion)</LatestRuntimeFrameworkVersion>
+        <TargetingPackName>Microsoft.AspNetCore.App.Ref</TargetingPackName>
+        <TargetingPackVersion>$(LatestAspNetCoreReferenceVersion)</TargetingPackVersion>
+        <RuntimePackNamePatterns>Microsoft.AspNetCore.App.Runtime.**RID**</RuntimePackNamePatterns>
+        <RuntimePackRuntimeIdentifiers>linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86</RuntimePackRuntimeIdentifiers>
+        <IsTrimmable>true</IsTrimmable>
+      </KnownFrameworkReference>
+    </ItemGroup>
+  </Target>
+
   <ItemGroup>
     <None Include="$(MSBuildThisFileDirectory)THIRD-PARTY-NOTICES.txt" Pack="true" PackagePath="." />
 

+ 3 - 0
src/Components/test/E2ETest/Microsoft.AspNetCore.Components.E2ETests.csproj

@@ -7,6 +7,9 @@
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <TestGroupName>Components.E2ETests</TestGroupName>
 
+    <!-- This is so that we add the FrameworkReference to Microsoft.AspNetCore.App -->
+    <UseLatestAspNetCoreReference>true</UseLatestAspNetCoreReference>
+
     <!-- https://github.com/aspnet/AspNetCore/issues/6857 -->
     <BuildHelixPayload>false</BuildHelixPayload>
 

+ 2 - 6
src/Components/test/testassets/TestServer/Components.TestServer.csproj

@@ -2,18 +2,14 @@
 
   <PropertyGroup>
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
+    <!-- This is so that we add the FrameworkReference to Microsoft.AspNetCore.App -->
+    <UseLatestAspNetCoreReference>true</UseLatestAspNetCoreReference>
   </PropertyGroup>
 
   <ItemGroup>
-    <Reference Include="Microsoft.AspNetCore" />
-    <Reference Include="Microsoft.AspNetCore.Authentication.Cookies" />
     <Reference Include="Microsoft.AspNetCore.Blazor.Server" />
-    <Reference Include="Microsoft.AspNetCore.Components.Server" />
-    <Reference Include="Microsoft.AspNetCore.Cors" />
-    <Reference Include="Microsoft.AspNetCore.Mvc" />
     <Reference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" />
     <Reference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" />
-    <Reference Include="Microsoft.Extensions.Hosting" />
     <Reference Include="Microsoft.Extensions.Logging.Testing" />
   </ItemGroup>
 

+ 4 - 1
src/ProjectTemplates/test/Infrastructure/GenerateTestProps.targets

@@ -16,6 +16,9 @@
     <PropertyGroup>
       <MicrosoftAspNetCoreAppRefPackageVersion Condition="'$(IsTargetingPackBuilding)' != 'false'">%(_TargetingPackVersionInfo.PackageVersion)</MicrosoftAspNetCoreAppRefPackageVersion>
       <MicrosoftAspNetCoreAppRefPackageVersion Condition="'$(IsTargetingPackBuilding)' == 'false'">$(AspNetCoreBaselineVersion)</MicrosoftAspNetCoreAppRefPackageVersion>
+
+    <!-- For blazor-wasm we want the runtime to match the baseline, as we want to target the latest released asp.net core app -->
+    <MicrosoftAspNetCoreAppRuntimePackageVersion>$(AspNetCoreBaselineVersion)</MicrosoftAspNetCoreAppRuntimePackageVersion>
     </PropertyGroup>
 
     <!-- Runtime and Ref packs may have separate versions. -->
@@ -34,7 +37,7 @@
         MicrosoftNETCorePlatformsPackageVersion=$(MicrosoftNETCorePlatformsPackageVersion);
         MicrosoftNETSdkRazorPackageVersion=$(MicrosoftNETSdkRazorPackageVersion);
         MicrosoftAspNetCoreAppRefPackageVersion=$(MicrosoftAspNetCoreAppRefPackageVersion);
-        MicrosoftAspNetCoreAppRuntimePackageVersion=@(_RuntimePackageVersionInfo->'%(PackageVersion)');
+        MicrosoftAspNetCoreAppRuntimePackageVersion=$(MicrosoftAspNetCoreAppRuntimePackageVersion);
         SupportedRuntimeIdentifiers=$(SupportedRuntimeIdentifiers);
         DefaultNetCoreTargetFramework=$(DefaultNetCoreTargetFramework);
       </PropsProperties>