Skip to content

Commit 3091f12

Browse files
authored
Update to .NET 8, NUnit 4, other dev packages (#223)
1 parent c25d8f0 commit 3091f12

File tree

18 files changed

+68
-46
lines changed

18 files changed

+68
-46
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup .NET Core
2525
uses: actions/setup-dotnet@v1
2626
with:
27-
dotnet-version: 6.0.423
27+
dotnet-version: 8.0.300
2828

2929
- name: Build WTG.Analyzers
3030
run: dotnet build src --configuration ${{ matrix.configuration }}
@@ -51,7 +51,7 @@ jobs:
5151
- name: Setup .NET Core
5252
uses: actions/setup-dotnet@v1
5353
with:
54-
dotnet-version: 6.0.423
54+
dotnet-version: 8.0.300
5555

5656
- name: Build NuGet Package
5757
run: dotnet pack src -p:CommitID=${{ github.sha }}

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Setup .NET Core
2727
uses: actions/setup-dotnet@v1
2828
with:
29-
dotnet-version: 6.0.423
29+
dotnet-version: 8.0.300
3030

3131
- name: Create NuGet Packages
3232
run: dotnet pack src --configuration Release /p:CommitID=${{ github.sha }} /p:TagVersion=${{ steps.tag_name.outputs.result }}

WTG.Analyzers.TestFramework.nuspec

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
<developmentDependency>true</developmentDependency>
1414
<icon>images\icon.png</icon>
1515
<dependencies>
16-
<group targetFramework=".NETStandard2.0" />
16+
<group targetFramework=".NETFramework4.6.2" />
17+
<group targetFramework="net6.0" />
1718
</dependencies>
1819
</metadata>
1920

2021
<files>
2122
<!-- Binaries -->
22-
<file src="bin\netstandard2.0\WTG.Analyzers.TestFramework.dll" target="lib\netstandard2.0" />
23+
<file src="bin\net462\WTG.Analyzers.TestFramework.dll" target="lib\net462" />
24+
<file src="bin\net6.0\WTG.Analyzers.TestFramework.dll" target="lib\net6.0" />
2325

2426
<!-- Other -->
2527
<file src="LICENSE.md" target="" />

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.100",
3+
"version": "8.0.300",
44
"rollForward": "latestMinor"
55
}
66
}

src/WTG.Analyzers.Test/RuleSetTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void WarnAll()
2323
.Where(line => line.StartsWith(prefix, StringComparison.Ordinal))
2424
.Select(line => line.Split(delimiter, count: 2))
2525
.ToDictionary(
26-
parts => parts[0].Substring(prefix.Length, length: parts[0].IndexOf(".", startIndex: prefix.Length, StringComparison.Ordinal) - prefix.Length),
26+
parts => parts[0].Substring(prefix.Length, length: parts[0].IndexOf('.', startIndex: prefix.Length) - prefix.Length),
2727
parts => (DiagnosticSeverity)Enum.Parse(typeof(DiagnosticSeverity), parts[1].Trim(), ignoreCase: true));
2828

2929
var descriptors = typeof(Rules).GetFields()

src/WTG.Analyzers.Test/WTG.Analyzers.Test.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<AssemblyTitle>WTG Analyzers Test</AssemblyTitle>
5-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
5+
<TargetFrameworks>net472;net8.0</TargetFrameworks>
66
<OutputPath>..\..\bin</OutputPath>
77
</PropertyGroup>
88
<ItemGroup>
@@ -13,20 +13,20 @@
1313
</ItemGroup>
1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
16-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
16+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
1717
<PrivateAssets>all</PrivateAssets>
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
</PackageReference>
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
21-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2">
20+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
21+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
<PrivateAssets>all</PrivateAssets>
2424
</PackageReference>
25-
<PackageReference Include="NUnit.Analyzers" Version="3.5.0">
25+
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
2626
<PrivateAssets>all</PrivateAssets>
2727
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2828
</PackageReference>
29-
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1">
29+
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0">
3030
<PrivateAssets>all</PrivateAssets>
3131
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3232
</PackageReference>

src/WTG.Analyzers.TestFramework.Test/WTG.Analyzers.TestFramework.Test.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
44
<AssemblyTitle>WTG Analyzers Test Framework Test</AssemblyTitle>
5-
<TargetFrameworks>net472;net6.0</TargetFrameworks>
5+
<TargetFrameworks>net472;net8.0</TargetFrameworks>
66
<OutputPath>..\..\bin</OutputPath>
77
</PropertyGroup>
88
<ItemGroup>
9-
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
9+
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
14-
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2">
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
14+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
1515
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1616
<PrivateAssets>all</PrivateAssets>
1717
</PackageReference>
18-
<PackageReference Include="NUnit.Analyzers" Version="3.5.0">
18+
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
1919
<PrivateAssets>all</PrivateAssets>
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2121
</PackageReference>
22-
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1">
22+
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0">
2323
<PrivateAssets>all</PrivateAssets>
2424
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2525
</PackageReference>

src/WTG.Analyzers.TestFramework/Constraints/DiagnosticConstraint.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public DiagnosticConstraint(IEnumerable<DiagnosticResult> expected)
1313
{
1414
}
1515

16+
public override string Description => "has specified diagnostics";
17+
1618
public override ConstraintResult ApplyTo<TActual>(TActual actual)
1719
{
1820
if (actual == null)
@@ -24,7 +26,7 @@ public override ConstraintResult ApplyTo<TActual>(TActual actual)
2426
{
2527
return ApplyTo(
2628
tmp.Select(DiagnosticConversion.Convert),
27-
(IEnumerable<DiagnosticResult>)Arguments[0]);
29+
(IEnumerable<DiagnosticResult>)Arguments[0]!);
2830
}
2931

3032
return new ConstraintResult(this, actual);

src/WTG.Analyzers.TestFramework/Helpers/CodeFixer.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.Linq;
45
using System.Threading;
56
using System.Threading.Tasks;
@@ -205,10 +206,12 @@ static async Task ReportNewCompilerDiagnosticAsync(Document document, IEnumerabl
205206
var tree = await document.GetSyntaxRootAsync().ConfigureAwait(false);
206207

207208
Assert.Fail(
208-
"Fix introduced new compiler diagnostics:{0}{1}{0}{0}New document:{0}{2}{0}",
209-
Environment.NewLine,
210-
string.Join(Environment.NewLine, newCompilerDiagnostics.Select(d => d.ToString())),
211-
tree?.ToFullString());
209+
string.Format(
210+
CultureInfo.InvariantCulture,
211+
"Fix introduced new compiler diagnostics:{0}{1}{0}{0}New document:{0}{2}{0}",
212+
Environment.NewLine,
213+
string.Join(Environment.NewLine, newCompilerDiagnostics.Select(d => d.ToString())),
214+
tree?.ToFullString()));
212215
}
213216

214217
static async Task<Document> ApplyFixAsync(Document document, CodeAction codeAction)

src/WTG.Analyzers.TestFramework/TestData/DiagnosticConversion.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Collections.Immutable;
1+
using System.Collections.Immutable;
2+
using System.Globalization;
23
using Microsoft.CodeAnalysis;
34

45
namespace WTG.Analyzers.TestFramework
@@ -22,7 +23,7 @@ public static DiagnosticResult Convert(Diagnostic diagnostic)
2223
return new DiagnosticResult(
2324
diagnostic.Id,
2425
diagnostic.Severity,
25-
diagnostic.GetMessage(),
26+
diagnostic.GetMessage(CultureInfo.InvariantCulture),
2627
builder.ToImmutable());
2728
}
2829

0 commit comments

Comments
 (0)