Skip to content

Commit

Permalink
* now will only enable Roslyn analyzer when building configuration is…
Browse files Browse the repository at this point in the history
… `Release` instead of `Debug`, also changed `<TreatWarningsAsErrors>` in `Directory.Build.props`

* update NuGet packages
@ c#/shared

* now will build under configuration `Release` @ .github/workflows/c#.yml
  • Loading branch information
n0099 committed Apr 30, 2024
1 parent 15ad7c3 commit 45abab5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/c#.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/c#
- run: dotnet build --no-restore -c Debug ${{ matrix.project }}
- run: dotnet build --no-restore -c Release ${{ matrix.project }}

ReSharper:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions c#/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AnalysisMode>Recommended</AnalysisMode>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
Expand Down
18 changes: 9 additions & 9 deletions c#/shared/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
},
"Meziantou.Analyzer": {
"type": "Direct",
"requested": "[2.0.149, )",
"resolved": "2.0.149",
"contentHash": "nJaiWMp6AlosBpl3sJO/frbqiImPBHodaJpcwlA/ez3zwjj9ZF4oeH0tWHSRFW8+e5mJMswlc3Kwl8DFskVOCg=="
"requested": "[2.0.150, )",
"resolved": "2.0.150",
"contentHash": "rXKN4/Cf58Pv7uUWk4wcZtY+J9mve6wA1BHGYAf9SlpmiayA5fJ4wK2lflIwAkVo8n8HyNCeY3Ej4jwCdLk5nA=="
},
"Microsoft.CodeAnalysis.NetAnalyzers": {
"type": "Direct",
Expand Down Expand Up @@ -118,13 +118,13 @@
},
"NLog.Extensions.Logging": {
"type": "Direct",
"requested": "[5.3.8, )",
"resolved": "5.3.8",
"contentHash": "6VD0lyeokWltL6j8lO7mS7v7lbuO/qn0F7kdvhKhEx1JvFyD39nzohOK3JvkVh4Nn3mrcMDCyDxvTvmiW55jQg==",
"requested": "[5.3.9, )",
"resolved": "5.3.9",
"contentHash": "NiZfTr1cZeEycW8OFOGQw4dTkxYCD3VnUHLDn/Fr+ALGOICLnPyRWFlLWGz01jq7BcgDdFmTWbCpbXNhXFu3DQ==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging": "8.0.0",
"NLog": "5.2.8"
"NLog": "5.3.1"
}
},
"Npgsql.EntityFrameworkCore.PostgreSQL": {
Expand Down Expand Up @@ -463,8 +463,8 @@
},
"NLog": {
"type": "Transitive",
"resolved": "5.2.8",
"contentHash": "jAIELkWBs1CXFPp986KSGpDFQZHCFccO+LMbKBTTNm42KifaI1mYzFMFQQfuGmGMTrCx0TFPhDjHDE4cLAZWiQ=="
"resolved": "5.3.1",
"contentHash": "P5ipL1rWveuZYLff++q5QDNJST0KW3z42Y/VkXUxURELuONAg9nxYziY0J9nrwQYKr18qtqNqjGYBTFxABc9kg=="
},
"Npgsql": {
"type": "Transitive",
Expand Down
6 changes: 3 additions & 3 deletions c#/shared/tbm.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
<PackageReference Include="EFCore.NamingConventions" Version="8.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.9" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="SuperLinq" Version="6.0.0" />
</ItemGroup>
<Choose>
<When Condition="'$(Configuration)' == 'Debug'">
<When Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<!-- https://stackoverflow.com/questions/73180516/if-a-nuget-specifies-privateassets-all-why-specify-includeassets -->
<!-- enable PrivateAssets="All" will prevent analyzers working on other project that has <PackageReference> to this -->
<PackageReference ExcludeAssets="compile" Include="codecracker.CSharp" Version="1.1.0" />
<PackageReference ExcludeAssets="compile" Include="CSharpGuidelinesAnalyzer" Version="3.8.5" />
<PackageReference ExcludeAssets="compile" Include="IDisposableAnalyzers" Version="4.0.7" />
<PackageReference ExcludeAssets="compile" Include="Meziantou.Analyzer" Version="2.0.149" />
<PackageReference ExcludeAssets="compile" Include="Meziantou.Analyzer" Version="2.0.150" />
<PackageReference ExcludeAssets="compile" Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0" />
<PackageReference ExcludeAssets="compile" Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28" />
<PackageReference ExcludeAssets="compile" Include="Roslynator.Analyzers" Version="4.12.2" />
Expand Down

0 comments on commit 45abab5

Please sign in to comment.