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 May 1, 2024
1 parent 15ad7c3 commit c85788a
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 41 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
24 changes: 12 additions & 12 deletions c#/crawler/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@
},
"Meziantou.Analyzer": {
"type": "Transitive",
"resolved": "2.0.149",
"contentHash": "nJaiWMp6AlosBpl3sJO/frbqiImPBHodaJpcwlA/ez3zwjj9ZF4oeH0tWHSRFW8+e5mJMswlc3Kwl8DFskVOCg=="
"resolved": "2.0.150",
"contentHash": "rXKN4/Cf58Pv7uUWk4wcZtY+J9mve6wA1BHGYAf9SlpmiayA5fJ4wK2lflIwAkVo8n8HyNCeY3Ej4jwCdLk5nA=="
},
"Microsoft.CodeAnalysis.NetAnalyzers": {
"type": "Transitive",
Expand Down Expand Up @@ -507,17 +507,17 @@
},
"NLog": {
"type": "Transitive",
"resolved": "5.2.8",
"contentHash": "jAIELkWBs1CXFPp986KSGpDFQZHCFccO+LMbKBTTNm42KifaI1mYzFMFQQfuGmGMTrCx0TFPhDjHDE4cLAZWiQ=="
"resolved": "5.3.2",
"contentHash": "cQRQZuDMjSyMe9EQBnI9v55YAMMz8GAfFd6fFJ6tc/kXnG7Hze8p1I8MgvWSBG6E36wA8vSxRrlm8uSIG+SENg=="
},
"NLog.Extensions.Logging": {
"type": "Transitive",
"resolved": "5.3.8",
"contentHash": "6VD0lyeokWltL6j8lO7mS7v7lbuO/qn0F7kdvhKhEx1JvFyD39nzohOK3JvkVh4Nn3mrcMDCyDxvTvmiW55jQg==",
"resolved": "5.3.10",
"contentHash": "P8KHXHin9bcbsL/c8p3Q4PARFkuH/YIo0+9ENvq9Mb2vgXWVi0Nr3Z8Hb1hmkVU1txc0d2z8CIB25nKMLItdyA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging": "8.0.0",
"NLog": "5.2.8"
"NLog": "5.3.2"
}
},
"Npgsql": {
Expand Down Expand Up @@ -561,8 +561,8 @@
},
"SuperLinq": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "g7LSvvsTW9/CFtro2+rz5vdCzHWSE5e8oQ1HYxrbJNHNOzlcrOBBKRe/YXTlodcpDBGvdueCNkBnU0Ie3WBnGg=="
"resolved": "6.0.1",
"contentHash": "vHJgD77xAb2852WhvJ8lC+ztYw475jG4/9MvOaXl+mCM5S/TSPdAAUEBmYDcawoN/RbtdjUdfMS0IRqyZSqEYw=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "Transitive",
Expand Down Expand Up @@ -607,18 +607,18 @@
"CommunityToolkit.Diagnostics": "[8.2.2, )",
"EFCore.NamingConventions": "[8.0.3, )",
"IDisposableAnalyzers": "[4.0.7, )",
"Meziantou.Analyzer": "[2.0.149, )",
"Meziantou.Analyzer": "[2.0.150, )",
"Microsoft.CodeAnalysis.NetAnalyzers": "[8.0.0, )",
"Microsoft.EntityFrameworkCore": "[8.0.4, )",
"Microsoft.Extensions.Hosting": "[8.0.0, )",
"Microsoft.VisualStudio.Threading.Analyzers": "[17.9.28, )",
"NLog.Extensions.Logging": "[5.3.8, )",
"NLog.Extensions.Logging": "[5.3.10, )",
"Npgsql.EntityFrameworkCore.PostgreSQL": "[8.0.2, )",
"Roslynator.Analyzers": "[4.12.2, )",
"SharpSource": "[1.24.0, )",
"SonarAnalyzer.CSharp": "[9.24.0.89429, )",
"StyleCop.Analyzers.Unstable": "[1.2.0.556, )",
"SuperLinq": "[6.0.0, )",
"SuperLinq": "[6.0.1, )",
"codecracker.CSharp": "[1.1.0, )"
}
}
Expand Down
24 changes: 12 additions & 12 deletions c#/imagePipeline/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@
},
"Meziantou.Analyzer": {
"type": "Transitive",
"resolved": "2.0.149",
"contentHash": "nJaiWMp6AlosBpl3sJO/frbqiImPBHodaJpcwlA/ez3zwjj9ZF4oeH0tWHSRFW8+e5mJMswlc3Kwl8DFskVOCg=="
"resolved": "2.0.150",
"contentHash": "rXKN4/Cf58Pv7uUWk4wcZtY+J9mve6wA1BHGYAf9SlpmiayA5fJ4wK2lflIwAkVo8n8HyNCeY3Ej4jwCdLk5nA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
Expand Down Expand Up @@ -558,17 +558,17 @@
},
"NLog": {
"type": "Transitive",
"resolved": "5.2.8",
"contentHash": "jAIELkWBs1CXFPp986KSGpDFQZHCFccO+LMbKBTTNm42KifaI1mYzFMFQQfuGmGMTrCx0TFPhDjHDE4cLAZWiQ=="
"resolved": "5.3.2",
"contentHash": "cQRQZuDMjSyMe9EQBnI9v55YAMMz8GAfFd6fFJ6tc/kXnG7Hze8p1I8MgvWSBG6E36wA8vSxRrlm8uSIG+SENg=="
},
"NLog.Extensions.Logging": {
"type": "Transitive",
"resolved": "5.3.8",
"contentHash": "6VD0lyeokWltL6j8lO7mS7v7lbuO/qn0F7kdvhKhEx1JvFyD39nzohOK3JvkVh4Nn3mrcMDCyDxvTvmiW55jQg==",
"resolved": "5.3.10",
"contentHash": "P8KHXHin9bcbsL/c8p3Q4PARFkuH/YIo0+9ENvq9Mb2vgXWVi0Nr3Z8Hb1hmkVU1txc0d2z8CIB25nKMLItdyA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging": "8.0.0",
"NLog": "5.2.8"
"NLog": "5.3.2"
}
},
"Npgsql": {
Expand Down Expand Up @@ -665,8 +665,8 @@
},
"SuperLinq": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "g7LSvvsTW9/CFtro2+rz5vdCzHWSE5e8oQ1HYxrbJNHNOzlcrOBBKRe/YXTlodcpDBGvdueCNkBnU0Ie3WBnGg=="
"resolved": "6.0.1",
"contentHash": "vHJgD77xAb2852WhvJ8lC+ztYw475jG4/9MvOaXl+mCM5S/TSPdAAUEBmYDcawoN/RbtdjUdfMS0IRqyZSqEYw=="
},
"System.Collections": {
"type": "Transitive",
Expand Down Expand Up @@ -955,18 +955,18 @@
"CommunityToolkit.Diagnostics": "[8.2.2, )",
"EFCore.NamingConventions": "[8.0.3, )",
"IDisposableAnalyzers": "[4.0.7, )",
"Meziantou.Analyzer": "[2.0.149, )",
"Meziantou.Analyzer": "[2.0.150, )",
"Microsoft.CodeAnalysis.NetAnalyzers": "[8.0.0, )",
"Microsoft.EntityFrameworkCore": "[8.0.4, )",
"Microsoft.Extensions.Hosting": "[8.0.0, )",
"Microsoft.VisualStudio.Threading.Analyzers": "[17.9.28, )",
"NLog.Extensions.Logging": "[5.3.8, )",
"NLog.Extensions.Logging": "[5.3.10, )",
"Npgsql.EntityFrameworkCore.PostgreSQL": "[8.0.2, )",
"Roslynator.Analyzers": "[4.12.2, )",
"SharpSource": "[1.24.0, )",
"SonarAnalyzer.CSharp": "[9.24.0.89429, )",
"StyleCop.Analyzers.Unstable": "[1.2.0.556, )",
"SuperLinq": "[6.0.0, )",
"SuperLinq": "[6.0.1, )",
"codecracker.CSharp": "[1.1.0, )"
}
}
Expand Down
24 changes: 12 additions & 12 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.10, )",
"resolved": "5.3.10",
"contentHash": "P8KHXHin9bcbsL/c8p3Q4PARFkuH/YIo0+9ENvq9Mb2vgXWVi0Nr3Z8Hb1hmkVU1txc0d2z8CIB25nKMLItdyA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "8.0.0",
"Microsoft.Extensions.Logging": "8.0.0",
"NLog": "5.2.8"
"NLog": "5.3.2"
}
},
"Npgsql.EntityFrameworkCore.PostgreSQL": {
Expand Down Expand Up @@ -165,9 +165,9 @@
},
"SuperLinq": {
"type": "Direct",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "g7LSvvsTW9/CFtro2+rz5vdCzHWSE5e8oQ1HYxrbJNHNOzlcrOBBKRe/YXTlodcpDBGvdueCNkBnU0Ie3WBnGg=="
"requested": "[6.0.1, )",
"resolved": "6.0.1",
"contentHash": "vHJgD77xAb2852WhvJ8lC+ztYw475jG4/9MvOaXl+mCM5S/TSPdAAUEBmYDcawoN/RbtdjUdfMS0IRqyZSqEYw=="
},
"Microsoft.EntityFrameworkCore.Abstractions": {
"type": "Transitive",
Expand Down Expand Up @@ -463,8 +463,8 @@
},
"NLog": {
"type": "Transitive",
"resolved": "5.2.8",
"contentHash": "jAIELkWBs1CXFPp986KSGpDFQZHCFccO+LMbKBTTNm42KifaI1mYzFMFQQfuGmGMTrCx0TFPhDjHDE4cLAZWiQ=="
"resolved": "5.3.2",
"contentHash": "cQRQZuDMjSyMe9EQBnI9v55YAMMz8GAfFd6fFJ6tc/kXnG7Hze8p1I8MgvWSBG6E36wA8vSxRrlm8uSIG+SENg=="
},
"Npgsql": {
"type": "Transitive",
Expand Down
8 changes: 4 additions & 4 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.10" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageReference Include="SuperLinq" Version="6.0.0" />
<PackageReference Include="SuperLinq" Version="6.0.1" />
</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 c85788a

Please sign in to comment.