Skip to content

Commit 6f1c2b6

Browse files
.NET 11 for Tests (#3695)
* .NET 11 RC2 minimal changes * Heuristic for transport feed Roslyn selection * Microsoft.CodeAnalysis.NetAnalyzers from main NuGet feed * Use the VS2026 image * Switch all test projects to net11 * Extract constants * Include vsix with plain nuget.config files
1 parent b5fc0d5 commit 6f1c2b6

16 files changed

Lines changed: 99 additions & 34 deletions

File tree

.github/workflows/build-frontends.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- uses: actions/setup-dotnet@v5
2323
with:
24-
dotnet-version: '10.0.x'
24+
dotnet-version: '11.0.x'
2525
dotnet-quality: 'preview'
2626

2727
- name: Install dependencies

.github/workflows/build-ilspy.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ jobs:
1313
Build:
1414
permissions:
1515
packages: write # for dotnet nuget push
16-
runs-on: windows-2025
16+
runs-on: windows-2025-vs2026
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
Configuration: [ Debug, Release ]
2121
env:
2222
BuildPlatform: Any CPU
23-
StagingDirectory: buildartifacts
23+
StagingDirectory: buildartifacts
24+
BuildAndPublishVsix: true
2425

2526
steps:
2627
- run: mkdir -p $env:StagingDirectory
@@ -34,7 +35,7 @@ jobs:
3435

3536
- uses: actions/setup-dotnet@v5
3637
with:
37-
dotnet-version: '10.0.x'
38+
dotnet-version: '11.0.x'
3839
dotnet-quality: 'preview'
3940
env:
4041
DOTNET_INSTALL_DIR: ${{ runner.temp }}/.dotnet
@@ -63,10 +64,10 @@ jobs:
6364
Get-ChildItem Env: | Where-Object {$_.Name -Match "^ILSPY_"} | %{ echo "$($_.Name)=$($_.Value)" } | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
6465
6566
- name: Restore the application
66-
run: msbuild ILSpy.sln /t:Restore /p:RestoreEnablePackagePruning=false /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform
67+
run: dotnet restore ILSpy.sln /p:RestoreEnablePackagePruning=false /p:Configuration=${{ matrix.configuration }} /p:Platform="$env:BuildPlatform"
6768

6869
- name: Build
69-
run: msbuild ILSpy.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform /m
70+
run: dotnet build ILSpy.sln --no-restore -c ${{ matrix.configuration }} /p:Platform="$env:BuildPlatform" /m
7071

7172
- name: Format check
7273
run: dotnet-format whitespace --verify-no-changes --verbosity detailed ILSpy.sln
@@ -120,27 +121,27 @@ jobs:
120121
- name: Build Installer (x64 and arm64, framework-dependent)
121122
if: matrix.configuration == 'release'
122123
run: |
123-
msbuild ILSpy.Installer.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
124-
msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU"
125-
msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" /p:PlatformForInstaller="ARM64"
124+
dotnet msbuild ILSpy.Installer.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
125+
dotnet msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU"
126+
dotnet msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" /p:PlatformForInstaller="ARM64"
126127
127128
- name: Build VS Extensions (for 2017-2019 and 2022)
128-
if: matrix.configuration == 'release'
129+
if: matrix.configuration == 'release' && env.BuildAndPublishVsix == 'true'
129130
run: |
130131
msbuild ILSpy.VSExtensions.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
131132
msbuild ILSpy.VSExtensions.sln /p:Configuration="Release" /p:Platform="Any CPU"
132133
133134
# https://github.com/actions/upload-artifact
134135
- name: Upload VSIX (VS 2019) release build artifacts
135-
if: matrix.configuration == 'release'
136+
if: matrix.configuration == 'release' && env.BuildAndPublishVsix == 'true'
136137
uses: actions/upload-artifact@v7
137138
with:
138139
name: ILSpy VS Addin for VS 2017-2019 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
139140
path: ILSpy.AddIn\bin\${{ matrix.configuration }}\net472\*.vsix
140141
if-no-files-found: error
141142

142143
- name: Upload VSIX (VS 2022) release build artifacts
143-
if: matrix.configuration == 'release'
144+
if: matrix.configuration == 'release' && env.BuildAndPublishVsix == 'true'
144145
uses: actions/upload-artifact@v7
145146
with:
146147
name: ILSpy VS Addin for VS 2022 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- uses: actions/setup-dotnet@v5
3939
with:
40-
dotnet-version: '10.0.x'
40+
dotnet-version: '11.0.x'
4141
dotnet-quality: 'preview'
4242

4343
- name: Build

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<PackageVersion Include="K4os.Compression.LZ4" Version="1.3.8" />
1616
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="5.0.1" />
1717
<PackageVersion Include="McMaster.Extensions.Hosting.CommandLine" Version="5.0.1" />
18-
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.3.0" />
19-
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="5.3.0" />
18+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.6.0-2.26177.1" />
19+
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="5.6.0-2.26177.1" />
2020
<PackageVersion Include="Microsoft.DiaSymReader.Converter.Xml" Version="1.1.0-beta2-22171-02" />
2121
<PackageVersion Include="Microsoft.DiaSymReader" Version="1.4.0" />
2222
<PackageVersion Include="Microsoft.DiaSymReader.Native" Version="17.0.0-beta1.21524.1" />

ICSharpCode.Decompiler.TestRunner/ICSharpCode.Decompiler.TestRunner.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net10.0</TargetFramework>
5+
<TargetFramework>net11.0</TargetFramework>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

ICSharpCode.Decompiler.Tests/Helpers/RoslynToolset.cs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,40 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
4141
abstract class AbstractToolset
4242
{
4343
readonly SourceCacheContext cache;
44-
readonly SourceRepository repository;
45-
readonly FindPackageByIdResource resource;
44+
readonly SourceRepository repository, dotnetToolsFeed;
45+
readonly FindPackageByIdResource resource, dotnetToolsResource;
4646
protected readonly string baseDir;
4747

4848
public AbstractToolset(string baseDir)
4949
{
5050
this.cache = new SourceCacheContext();
5151
this.repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json");
5252
this.resource = repository.GetResource<FindPackageByIdResource>();
53+
this.dotnetToolsFeed = Repository.Factory.GetCoreV3("https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json");
54+
this.dotnetToolsResource = dotnetToolsFeed.GetResource<FindPackageByIdResource>();
5355
this.baseDir = baseDir;
5456
}
5557

58+
enum PackageVersionKind
59+
{
60+
Rtm,
61+
Preview,
62+
TransportFeed,
63+
}
64+
65+
// RTM versions look like 5.3.0, and preview ones like 4.12.0-3.final. Transport feed ones eg 5.6.0-2.26177.1
66+
static PackageVersionKind ClassifyVersion(NuGetVersion version)
67+
{
68+
if (!version.IsPrerelease)
69+
return PackageVersionKind.Rtm;
70+
71+
var labels = version.ReleaseLabels.ToList();
72+
bool looksLikeTransportFeed = labels.Count >= 3
73+
&& labels.All(static label => int.TryParse(label, out _));
74+
75+
return looksLikeTransportFeed ? PackageVersionKind.TransportFeed : PackageVersionKind.Preview;
76+
}
77+
5678
protected async Task FetchPackage(string packageName, string version, string sourcePath, string outputPath)
5779
{
5880
if (!Directory.Exists(Path.Combine(Roundtrip.RoundtripAssembly.TestDir, "nuget")))
@@ -70,9 +92,15 @@ protected async Task FetchPackage(string packageName, string version, string sou
7092
{
7193
packageStream = new MemoryStream();
7294

73-
await resource.CopyNupkgToStreamAsync(
95+
NuGetVersion parsedVersion = NuGetVersion.Parse(version);
96+
PackageVersionKind versionKind = ClassifyVersion(parsedVersion);
97+
FindPackageByIdResource selectedResource = versionKind == PackageVersionKind.TransportFeed
98+
? dotnetToolsResource
99+
: resource;
100+
101+
await selectedResource.CopyNupkgToStreamAsync(
74102
packageName,
75-
NuGetVersion.Parse(version),
103+
parsedVersion,
76104
packageStream,
77105
cache,
78106
logger,

ICSharpCode.Decompiler.Tests/Helpers/Tester.VB.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static async Task<CompilerResults> CompileVB(string sourceFileName, Compi
5353
CompilerOptions.UseRoslyn1_3_2 => ("1.3.2", "14", null),
5454
CompilerOptions.UseRoslyn2_10_0 => ("2.10.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v2.2"),
5555
CompilerOptions.UseRoslyn3_11_0 => ("3.11.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v5.0"),
56-
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : ".NETCoreApp,Version=v10.0")
56+
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : CurrentNetCoreAppVersion)
5757
};
5858

5959
var vbcPath = roslynToolset.GetVBCompiler(roslynVersion);

ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ public enum AssemblerOptions
9393

9494
public static partial class Tester
9595
{
96+
public const string CurrentNetCoreVersion = "11.0";
97+
public const string CurrentNetCoreAppVersion = ".NETCoreApp,Version=v11.0";
98+
public const string CurrentNetCoreRefAsmVersion = "11.0.0-preview.2.26159.112";
99+
96100
public static readonly string TesterPath;
97101
public static readonly string TestCasePath;
98102

@@ -108,9 +112,9 @@ static Tester()
108112
TesterPath = Path.GetDirectoryName(typeof(Tester).Assembly.Location);
109113
TestCasePath = Path.Combine(TesterPath, "../../../../TestCases");
110114
#if DEBUG
111-
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Debug/net10.0");
115+
testRunnerBasePath = Path.Combine(TesterPath, $"../../../../../ICSharpCode.Decompiler.TestRunner/bin/Debug/net{CurrentNetCoreVersion}");
112116
#else
113-
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net10.0");
117+
testRunnerBasePath = Path.Combine(TesterPath, $"../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net{CurrentNetCoreVersion}");
114118
#endif
115119
// To parse: <Project><ItemGroup><PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0-3.final" />
116120
packagesPropsFile = Path.Combine(TesterPath, "../../../../../Directory.Packages.props");
@@ -136,6 +140,7 @@ internal static async Task Initialize()
136140
await vswhereToolset.Fetch().ConfigureAwait(false);
137141
await RefAssembliesToolset.Fetch("5.0.0", sourcePath: "ref/net5.0").ConfigureAwait(false);
138142
await RefAssembliesToolset.Fetch("10.0.0", sourcePath: "ref/net10.0").ConfigureAwait(false);
143+
await RefAssembliesToolset.Fetch(CurrentNetCoreRefAsmVersion, sourcePath: $"ref/net{CurrentNetCoreVersion}").ConfigureAwait(false);
139144

140145
#if DEBUG
141146
await BuildTestRunner("win-x86", "Debug").ConfigureAwait(false);
@@ -341,7 +346,7 @@ private static string ReplacePrivImplDetails(string il)
341346
};
342347

343348
static readonly Dictionary<string, Lazy<string>> targetFrameworkAttributeSnippetFiles = new() {
344-
{ ".NETCoreApp,Version=v10.0", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v10.0")) },
349+
{ CurrentNetCoreAppVersion, new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(CurrentNetCoreAppVersion)) },
345350
{ ".NETCoreApp,Version=v5.0", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v5.0")) },
346351
{ ".NETCoreApp,Version=v2.2", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v2.2")) },
347352
};
@@ -454,12 +459,15 @@ public static List<string> GetPreprocessorSymbols(CompilerOptions flags)
454459
preprocessorSymbols.Add("NET80");
455460
preprocessorSymbols.Add("NET90");
456461
preprocessorSymbols.Add("NET100");
462+
preprocessorSymbols.Add("NET110");
457463
}
458464
preprocessorSymbols.Add("ROSLYN4");
459465
preprocessorSymbols.Add("CS100");
460466
preprocessorSymbols.Add("CS110");
461467
preprocessorSymbols.Add("CS120");
462468
preprocessorSymbols.Add("CS130");
469+
preprocessorSymbols.Add("CS140");
470+
preprocessorSymbols.Add("CS150");
463471
}
464472
}
465473
else if ((flags & CompilerOptions.UseMcsMask) != 0)
@@ -520,7 +528,7 @@ public static async Task<CompilerResults> CompileCSharp(string sourceFileName, C
520528
CompilerOptions.UseRoslyn1_3_2 => ("1.3.2", "6", null),
521529
CompilerOptions.UseRoslyn2_10_0 => ("2.10.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v2.2"),
522530
CompilerOptions.UseRoslyn3_11_0 => ("3.11.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v5.0"),
523-
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : ".NETCoreApp,Version=v10.0")
531+
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : CurrentNetCoreAppVersion)
524532
};
525533

526534
var cscPath = roslynToolset.GetCSharpCompiler(roslynVersion);
@@ -770,7 +778,7 @@ public static void CompileCSharpWithPdb(string assemblyName, Dictionary<string,
770778
}
771779

772780
var compilation = CSharpCompilation.Create(Path.GetFileNameWithoutExtension(assemblyName),
773-
syntaxTrees, coreDefaultReferences.Select(r => MetadataReference.CreateFromFile(Path.Combine(RefAssembliesToolset.GetPath(".NETCoreApp,Version=v10.0"), r))),
781+
syntaxTrees, coreDefaultReferences.Select(r => MetadataReference.CreateFromFile(Path.Combine(RefAssembliesToolset.GetPath(CurrentNetCoreAppVersion), r))),
774782
new CSharpCompilationOptions(
775783
OutputKind.DynamicallyLinkedLibrary,
776784
platform: Platform.AnyCpu,

ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<PropertyGroup>
10-
<TargetFramework>net10.0-windows</TargetFramework>
10+
<TargetFramework>net11.0-windows</TargetFramework>
1111
<LangVersion>preview</LangVersion>
1212
<RuntimeIdentifier Condition="$(IsWindowsX64) == true">win-x64</RuntimeIdentifier>
1313
<RuntimeIdentifier Condition="$(IsWindowsARM64) == true">win-arm64</RuntimeIdentifier>

ILSpy.AddIn.VS2022/NuGet.config

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
6+
</packageSources>
7+
<packageSourceMapping>
8+
<clear />
9+
<packageSource key="nuget.org">
10+
<package pattern="*" />
11+
</packageSource>
12+
</packageSourceMapping>
13+
</configuration>

0 commit comments

Comments
 (0)