From b6a098299a0d2402eeebf6e8fafacbf2e33bf254 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Fri, 17 Sep 2021 20:49:03 -0700 Subject: [PATCH 1/2] Pin analyzers that ship in the SDK (#36690) * Pin analyzers that ship in the SDK ASP.NET Core produces a few analyzer assemblies that are shipped as part of the .NET SDK. These analyzers are added to web projects targeting 3.1 and newer. In 6.0, we (unintentionally) bumped the version of Microsoft.CodeAnalysis that these projects referenced to a 4.0 version. This causes warnings when opening a 3.1 or 5.0 app in VS 2019 as it does not support these versions. Additionally update the version of Microsoft.CodeAnalysis.* packages used in tests, Razor, and framework analyzers that are only expected to run with VS 2020 to a more recent build. This is largely book-keeping, but allows us to write a test for file scoped namespaces. Fixes https://github.com/dotnet/aspnetcore/issues/36552 --- eng/Versions.props | 13 ++++++++++--- .../src/Microsoft.AspNetCore.Analyzers.csproj | 3 ++- src/Analyzers/Analyzers/test/MinimalStartupTest.cs | 3 +++ ...Microsoft.AspNetCore.Components.Analyzers.csproj | 3 ++- .../src/Microsoft.AspNetCore.Mvc.Analyzers.csproj | 3 ++- .../Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj | 3 ++- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index f3041be153a8..6d09154199af 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -184,9 +184,16 @@ 16.9.0 1.2.6 16.9.0 - 4.0.0-2.21354.7 - 4.0.0-2.21354.7 - 4.0.0-2.21354.7 + + 3.3.1 + 3.3.1 + + 4.0.0-4.final + 4.0.0-4.final + 4.0.0-4.final 3.3.0 1.1.1-beta1.21413.1 1.0.0-20200708.1 diff --git a/src/Analyzers/Analyzers/src/Microsoft.AspNetCore.Analyzers.csproj b/src/Analyzers/Analyzers/src/Microsoft.AspNetCore.Analyzers.csproj index d0e52bc923bb..01f8879aff83 100644 --- a/src/Analyzers/Analyzers/src/Microsoft.AspNetCore.Analyzers.csproj +++ b/src/Analyzers/Analyzers/src/Microsoft.AspNetCore.Analyzers.csproj @@ -18,7 +18,8 @@ - + + diff --git a/src/Analyzers/Analyzers/test/MinimalStartupTest.cs b/src/Analyzers/Analyzers/test/MinimalStartupTest.cs index 5acd376109e5..170ae32b7600 100644 --- a/src/Analyzers/Analyzers/test/MinimalStartupTest.cs +++ b/src/Analyzers/Analyzers/test/MinimalStartupTest.cs @@ -53,6 +53,9 @@ public async Task StartupAnalyzer_WorksWithNonImplicitMain() using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; + +namespace MyApp; + public class Program { public static void Main(string[] args) diff --git a/src/Components/Analyzers/src/Microsoft.AspNetCore.Components.Analyzers.csproj b/src/Components/Analyzers/src/Microsoft.AspNetCore.Components.Analyzers.csproj index 4030f6276753..0535a905cc1f 100644 --- a/src/Components/Analyzers/src/Microsoft.AspNetCore.Components.Analyzers.csproj +++ b/src/Components/Analyzers/src/Microsoft.AspNetCore.Components.Analyzers.csproj @@ -9,7 +9,8 @@ - + + diff --git a/src/Mvc/Mvc.Analyzers/src/Microsoft.AspNetCore.Mvc.Analyzers.csproj b/src/Mvc/Mvc.Analyzers/src/Microsoft.AspNetCore.Mvc.Analyzers.csproj index 0c1f99086369..68199acfdf43 100644 --- a/src/Mvc/Mvc.Analyzers/src/Microsoft.AspNetCore.Mvc.Analyzers.csproj +++ b/src/Mvc/Mvc.Analyzers/src/Microsoft.AspNetCore.Mvc.Analyzers.csproj @@ -12,7 +12,8 @@ - + + diff --git a/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj b/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj index cee3068b1ba1..0b94ad2a8f25 100644 --- a/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj +++ b/src/Mvc/Mvc.Api.Analyzers/src/Microsoft.AspNetCore.Mvc.Api.Analyzers.csproj @@ -17,7 +17,8 @@ - + + From 433d3acbb450cfb092217454fc892ba3719691ce Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 20 Sep 2021 12:06:16 -0700 Subject: [PATCH 2/2] Apply suggestions from code review --- eng/Versions.props | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 6d09154199af..f22d899ea97d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -191,9 +191,9 @@ 3.3.1 3.3.1 - 4.0.0-4.final - 4.0.0-4.final - 4.0.0-4.final + 4.0.0-3.final + 4.0.0-3.final + 4.0.0-3.final 3.3.0 1.1.1-beta1.21413.1 1.0.0-20200708.1