diff options
author | Santiago Fernandez Madero <safern@microsoft.com> | 2020-08-15 03:13:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-15 03:13:44 +0300 |
commit | 732ea740a112eb52e82bc190f1a25451850c7488 (patch) | |
tree | 1d09d66da69ed7f735e3eb9fad86a4606dfd97e0 | |
parent | 12f46e41eb01ba2c6601bf8222931e8c1a3e17c3 (diff) |
Update analyzers and various fixes to be able to build with latest RC1 SDK (#40796)
* Disable net analyzers from the SDK and use them from package reference instead
* Fix build with new SDK and bump net analyzer version
* PR Feedback
-rw-r--r-- | Directory.Build.props | 3 | ||||
-rw-r--r-- | Directory.Build.targets | 2 | ||||
-rw-r--r-- | eng/Analyzers.props | 2 | ||||
-rw-r--r-- | eng/referenceAssemblies.props | 3 | ||||
-rw-r--r-- | eng/targetingpacks.targets | 5 |
5 files changed, 14 insertions, 1 deletions
diff --git a/Directory.Build.props b/Directory.Build.props index ff2883becc6..2d93ed80c96 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -84,6 +84,9 @@ <!-- We don't want Private packages to be shipped to NuGet.org --> <IsShippingPackage Condition="($(MSBuildProjectName.Contains('Private')) or $(IsExperimentalAssembly)) and '$(MSBuildProjectExtension)' == '.pkgproj'">false</IsShippingPackage> + + <!-- By default the SDK produces ref assembly for 5.0 or later --> + <ProduceReferenceAssembly>false</ProduceReferenceAssembly> </PropertyGroup> <!-- Language configuration --> diff --git a/Directory.Build.targets b/Directory.Build.targets index f16e04d9b4e..e4c7e1d21a5 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -6,6 +6,8 @@ tell Microsoft.Common.targets not to import Directory.Build.targets again --> <ImportDirectoryBuildTargets>false</ImportDirectoryBuildTargets> + + <EnableNETAnalyzers Condition="'$(EnableAnalyzers)' != 'true'">false</EnableNETAnalyzers> </PropertyGroup> <Import Project="$(RepositoryEngineeringDir)liveBuilds.targets" /> diff --git a/eng/Analyzers.props b/eng/Analyzers.props index 34eb83dff69..ff442658c33 100644 --- a/eng/Analyzers.props +++ b/eng/Analyzers.props @@ -6,7 +6,7 @@ </PropertyGroup> <ItemGroup Condition="'$(EnableAnalyzers)' == 'true'"> <PackageReference Include="Microsoft.DotNet.CodeAnalysis" Version="$(MicrosoftDotNetCodeAnalysisVersion)" PrivateAssets="all" IsImplicitlyDefined="true" /> - <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="3.3.0-beta3.20410.1" PrivateAssets="all" /> + <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.0-rc1.20413.9" PrivateAssets="all" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164" PrivateAssets="all" /> </ItemGroup> </Project> diff --git a/eng/referenceAssemblies.props b/eng/referenceAssemblies.props index 94508fa244a..4aabb96b899 100644 --- a/eng/referenceAssemblies.props +++ b/eng/referenceAssemblies.props @@ -4,6 +4,9 @@ !$(BuildTargetFramework.StartsWith('net4'))"> <AdditionalBuildTargetFrameworks>$(AdditionalBuildTargetFrameworks);netstandard2.0</AdditionalBuildTargetFrameworks> <AdditionalBuildTargetFrameworks Condition="!$(BuildTargetFramework.StartsWith('netcoreapp2.0'))">$(AdditionalBuildTargetFrameworks);netstandard2.1</AdditionalBuildTargetFrameworks> + + <!-- Reference assemblies are special and don't initialize fields or have empty finalizers, etc. --> + <EnableAnalyzers>false</EnableAnalyzers> </PropertyGroup> <PropertyGroup> diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets index e39ce8fdada..404f9552d07 100644 --- a/eng/targetingpacks.targets +++ b/eng/targetingpacks.targets @@ -6,6 +6,11 @@ <EnableTargetingPackDownload>false</EnableTargetingPackDownload> </PropertyGroup> + <PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and ('$(_ShortFrameworkIdentifier)' == '' or '$(_ShortFrameworkVersion)' == '')"> + <_ShortFrameworkIdentifier>$(TargetFramework.TrimEnd('.0123456789'))</_ShortFrameworkIdentifier> + <_ShortFrameworkVersion>$(TargetFramework.Substring($(_ShortFrameworkIdentifier.Length)))</_ShortFrameworkVersion> + </PropertyGroup> + <!-- .NETCoreApp 2.x DisableImplicitAssemblyReferences support. --> <Choose> <When Condition="'$(DisableImplicitAssemblyReferences)' == 'true' and |