Skip to content

Commit

Permalink
Update analyzers and various fixes to be able to build with latest RC…
Browse files Browse the repository at this point in the history
…1 SDK (dotnet#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
  • Loading branch information
safern authored Aug 15, 2020
1 parent 12f46e4 commit 732ea74
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -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 -->
Expand Down
2 changes: 2 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
2 changes: 1 addition & 1 deletion eng/Analyzers.props
Original file line number Diff line number Diff line change
Expand Up @@ -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>
3 changes: 3 additions & 0 deletions eng/referenceAssemblies.props
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions eng/targetingpacks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 732ea74

Please sign in to comment.