Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-606: Upgrade to C# 11 #86

Merged
merged 16 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Lombiq.Analyzers/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)orchardcore.ruleset</CodeAnalysisRuleSet>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Don't run analyzers during Visual Studio build, not to slow down development. They still run during dotnet build.
By making this conditional, it won't overwrite the value if you set it in the Directory.Build.props file. For
Rider users: https://youtrack.jetbrains.com/issue/RIDER-80579 -->
<!-- Don't run analyzers during Visual Studio build, not to slow down development. They still run during dotnet
build. By making this conditional, it won't overwrite the value if you set it in the Directory.Build.props
file. For Rider users: https://youtrack.jetbrains.com/issue/RIDER-80579 -->
0liver marked this conversation as resolved.
Show resolved Hide resolved
<RunAnalyzersDuringBuild Condition="'$(RunAnalyzersDuringBuild)' != 'true'">false</RunAnalyzersDuringBuild>
<!-- Needed for project targeting versions earlier than .NET 5. Only works with .NET Core and later projects, see:
https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview.
Expand All @@ -13,10 +13,10 @@
<!-- Strict mode for the C# compiler, see: https://www.meziantou.net/csharp-compiler-strict-mode.htm. -->
<Features>strict</Features>
<!-- Useful to set here since the language version affects which analyzers to use and how to configure them. -->
<LangVersion>10.0</LangVersion>
<LangVersion>11.0</LangVersion>
<!-- Setting the analysis level explicitly lets us opt in to new analyzers with SDK upgrades. See:
https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#latest-updates -->
<AnalysisLevel>6.0</AnalysisLevel>
<AnalysisLevel>7.0</AnalysisLevel>
<!-- This is for Microsoft.CodeAnalysis.NetAnalyzers. This way, we have control over it unlike when getting it
via the .NET SDK. See: https://docs.microsoft.com/en-us/visualstudio/code-quality/migrate-from-fxcop-analyzers-to-net-analyzers
.NET code style analysis is not working with .NET 5 though, see: https://github.com/dotnet/roslyn/issues/33558#issuecomment-867346974. -->
Expand Down
10 changes: 5 additions & 5 deletions Lombiq.Analyzers/CommonPackages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<ItemGroup>
<AnalyzerPackage Include="AsyncFixer" Version="1.6.0"/>
<AnalyzerPackage Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59"/>
<AnalyzerPackage Include="Meziantou.Analyzer" Version="2.0.5"/>
<AnalyzerPackage Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.4.0"/>
<AnalyzerPackage Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.0"/>
<AnalyzerPackage Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.4.33"/>
<AnalyzerPackage Include="Meziantou.Analyzer" Version="2.0.60"/>
<AnalyzerPackage Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="4.6.0"/>
<AnalyzerPackage Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="7.0.1"/>
<AnalyzerPackage Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.6.40"/>
<AnalyzerPackage Include="SecurityCodeScan.VS2019" Version="5.6.7"/>
<AnalyzerPackage Include="SonarAnalyzer.CSharp" Version="8.51.0.59060"/>
<AnalyzerPackage Include="SonarAnalyzer.CSharp" Version="9.2.0.71021"/>
<AnalyzerPackage Include="StyleCop.Analyzers" Version="1.2.0-beta.435"/>
</ItemGroup>

Expand Down
3 changes: 3 additions & 0 deletions Lombiq.Analyzers/Lombiq.Analyzers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);.git*;</DefaultItemExcludes>
<!-- This is duplicated with Lombiq.Analyzers.nuspec.template but is needed for the NuGet publishing workflow not to
throw a warning. See https://github.com/Lombiq/GitHub-Actions/issues/236. -->
<PackageLicenseFile>License.md</PackageLicenseFile>
</PropertyGroup>

<!-- This project is built with an externally generated .nuspec file so NuGet-related properties are not needed here.
Expand Down
1 change: 1 addition & 0 deletions Lombiq.Analyzers/general.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
<Rule Id="S1109" Action="Warning" />
<Rule Id="S113" Action="Warning" />
<Rule Id="S1144" Action="Warning" />
<Rule Id="S1133" Action="None" />
<Rule Id="S1145" Action="Warning" />
<Rule Id="S1147" Action="Warning" />
<Rule Id="S1151" Action="Warning" />
Expand Down
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Bug reports, feature requests, comments, questions, code contributions and love

This project is developed by [Lombiq Technologies](https://lombiq.com/). Commercial-grade support is available through Lombiq.

### Publishing a new NuGet package

When publishing a new version of the NuGet package, even if it's just a pre-release, also update the package references under _TestSolutions\Lombiq.Analyzers.PackageReferences_ to the new version. This is necessary to run the tests there.

### Upgrading to a new version of the .NET SDK

When a new version of the .NET SDK comes out then to the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-->

<ItemGroup Condition="'$(ImportPackageAgain)' == 'true'">
<PackageReference Include="Lombiq.Analyzers" Version="3.0.1">
<PackageReference Include="Lombiq.Analyzers" Version="3.1.2-alpha.3.osoce-606">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lombiq.Analyzers" Version="3.1.0">
<PackageReference Include="Lombiq.Analyzers" Version="3.1.2-alpha.3.osoce-606">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down