mirror of
https://github.com/icsharpcode/ILSpy.git
synced 2026-10-11 21:59:56 +00:00
.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
This commit is contained in:
@@ -21,7 +21,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
dotnet-version: '11.0.x'
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Install dependencies
|
||||
|
||||
@@ -13,14 +13,15 @@ jobs:
|
||||
Build:
|
||||
permissions:
|
||||
packages: write # for dotnet nuget push
|
||||
runs-on: windows-2025
|
||||
runs-on: windows-2025-vs2026
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
Configuration: [ Debug, Release ]
|
||||
env:
|
||||
BuildPlatform: Any CPU
|
||||
StagingDirectory: buildartifacts
|
||||
StagingDirectory: buildartifacts
|
||||
BuildAndPublishVsix: true
|
||||
|
||||
steps:
|
||||
- run: mkdir -p $env:StagingDirectory
|
||||
@@ -34,7 +35,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
dotnet-version: '11.0.x'
|
||||
dotnet-quality: 'preview'
|
||||
env:
|
||||
DOTNET_INSTALL_DIR: ${{ runner.temp }}/.dotnet
|
||||
@@ -63,10 +64,10 @@ jobs:
|
||||
Get-ChildItem Env: | Where-Object {$_.Name -Match "^ILSPY_"} | %{ echo "$($_.Name)=$($_.Value)" } | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
|
||||
- name: Restore the application
|
||||
run: msbuild ILSpy.sln /t:Restore /p:RestoreEnablePackagePruning=false /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform
|
||||
run: dotnet restore ILSpy.sln /p:RestoreEnablePackagePruning=false /p:Configuration=${{ matrix.configuration }} /p:Platform="$env:BuildPlatform"
|
||||
|
||||
- name: Build
|
||||
run: msbuild ILSpy.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=$env:BuildPlatform /m
|
||||
run: dotnet build ILSpy.sln --no-restore -c ${{ matrix.configuration }} /p:Platform="$env:BuildPlatform" /m
|
||||
|
||||
- name: Format check
|
||||
run: dotnet-format whitespace --verify-no-changes --verbosity detailed ILSpy.sln
|
||||
@@ -120,19 +121,19 @@ jobs:
|
||||
- name: Build Installer (x64 and arm64, framework-dependent)
|
||||
if: matrix.configuration == 'release'
|
||||
run: |
|
||||
msbuild ILSpy.Installer.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
|
||||
msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU"
|
||||
msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" /p:PlatformForInstaller="ARM64"
|
||||
dotnet msbuild ILSpy.Installer.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
|
||||
dotnet msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU"
|
||||
dotnet msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" /p:PlatformForInstaller="ARM64"
|
||||
|
||||
- name: Build VS Extensions (for 2017-2019 and 2022)
|
||||
if: matrix.configuration == 'release'
|
||||
if: matrix.configuration == 'release' && env.BuildAndPublishVsix == 'true'
|
||||
run: |
|
||||
msbuild ILSpy.VSExtensions.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU"
|
||||
msbuild ILSpy.VSExtensions.sln /p:Configuration="Release" /p:Platform="Any CPU"
|
||||
|
||||
# https://github.com/actions/upload-artifact
|
||||
- name: Upload VSIX (VS 2019) release build artifacts
|
||||
if: matrix.configuration == 'release'
|
||||
if: matrix.configuration == 'release' && env.BuildAndPublishVsix == 'true'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ILSpy VS Addin for VS 2017-2019 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
|
||||
@@ -140,7 +141,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload VSIX (VS 2022) release build artifacts
|
||||
if: matrix.configuration == 'release'
|
||||
if: matrix.configuration == 'release' && env.BuildAndPublishVsix == 'true'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ILSpy VS Addin for VS 2022 ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }})
|
||||
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '10.0.x'
|
||||
dotnet-version: '11.0.x'
|
||||
dotnet-quality: 'preview'
|
||||
|
||||
- name: Build
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<PackageVersion Include="K4os.Compression.LZ4" Version="1.3.8" />
|
||||
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="5.0.1" />
|
||||
<PackageVersion Include="McMaster.Extensions.Hosting.CommandLine" Version="5.0.1" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.3.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="5.3.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.6.0-2.26177.1" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="5.6.0-2.26177.1" />
|
||||
<PackageVersion Include="Microsoft.DiaSymReader.Converter.Xml" Version="1.1.0-beta2-22171-02" />
|
||||
<PackageVersion Include="Microsoft.DiaSymReader" Version="1.4.0" />
|
||||
<PackageVersion Include="Microsoft.DiaSymReader.Native" Version="17.0.0-beta1.21524.1" />
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<TargetFramework>net11.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
abstract class AbstractToolset
|
||||
{
|
||||
readonly SourceCacheContext cache;
|
||||
readonly SourceRepository repository;
|
||||
readonly FindPackageByIdResource resource;
|
||||
readonly SourceRepository repository, dotnetToolsFeed;
|
||||
readonly FindPackageByIdResource resource, dotnetToolsResource;
|
||||
protected readonly string baseDir;
|
||||
|
||||
public AbstractToolset(string baseDir)
|
||||
@@ -50,9 +50,31 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
this.cache = new SourceCacheContext();
|
||||
this.repository = Repository.Factory.GetCoreV3("https://api.nuget.org/v3/index.json");
|
||||
this.resource = repository.GetResource<FindPackageByIdResource>();
|
||||
this.dotnetToolsFeed = Repository.Factory.GetCoreV3("https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json");
|
||||
this.dotnetToolsResource = dotnetToolsFeed.GetResource<FindPackageByIdResource>();
|
||||
this.baseDir = baseDir;
|
||||
}
|
||||
|
||||
enum PackageVersionKind
|
||||
{
|
||||
Rtm,
|
||||
Preview,
|
||||
TransportFeed,
|
||||
}
|
||||
|
||||
// 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
|
||||
static PackageVersionKind ClassifyVersion(NuGetVersion version)
|
||||
{
|
||||
if (!version.IsPrerelease)
|
||||
return PackageVersionKind.Rtm;
|
||||
|
||||
var labels = version.ReleaseLabels.ToList();
|
||||
bool looksLikeTransportFeed = labels.Count >= 3
|
||||
&& labels.All(static label => int.TryParse(label, out _));
|
||||
|
||||
return looksLikeTransportFeed ? PackageVersionKind.TransportFeed : PackageVersionKind.Preview;
|
||||
}
|
||||
|
||||
protected async Task FetchPackage(string packageName, string version, string sourcePath, string outputPath)
|
||||
{
|
||||
if (!Directory.Exists(Path.Combine(Roundtrip.RoundtripAssembly.TestDir, "nuget")))
|
||||
@@ -70,9 +92,15 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
{
|
||||
packageStream = new MemoryStream();
|
||||
|
||||
await resource.CopyNupkgToStreamAsync(
|
||||
NuGetVersion parsedVersion = NuGetVersion.Parse(version);
|
||||
PackageVersionKind versionKind = ClassifyVersion(parsedVersion);
|
||||
FindPackageByIdResource selectedResource = versionKind == PackageVersionKind.TransportFeed
|
||||
? dotnetToolsResource
|
||||
: resource;
|
||||
|
||||
await selectedResource.CopyNupkgToStreamAsync(
|
||||
packageName,
|
||||
NuGetVersion.Parse(version),
|
||||
parsedVersion,
|
||||
packageStream,
|
||||
cache,
|
||||
logger,
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
CompilerOptions.UseRoslyn1_3_2 => ("1.3.2", "14", null),
|
||||
CompilerOptions.UseRoslyn2_10_0 => ("2.10.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v2.2"),
|
||||
CompilerOptions.UseRoslyn3_11_0 => ("3.11.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v5.0"),
|
||||
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : ".NETCoreApp,Version=v10.0")
|
||||
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : CurrentNetCoreAppVersion)
|
||||
};
|
||||
|
||||
var vbcPath = roslynToolset.GetVBCompiler(roslynVersion);
|
||||
|
||||
@@ -93,6 +93,10 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
|
||||
public static partial class Tester
|
||||
{
|
||||
public const string CurrentNetCoreVersion = "11.0";
|
||||
public const string CurrentNetCoreAppVersion = ".NETCoreApp,Version=v11.0";
|
||||
public const string CurrentNetCoreRefAsmVersion = "11.0.0-preview.2.26159.112";
|
||||
|
||||
public static readonly string TesterPath;
|
||||
public static readonly string TestCasePath;
|
||||
|
||||
@@ -108,9 +112,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
TesterPath = Path.GetDirectoryName(typeof(Tester).Assembly.Location);
|
||||
TestCasePath = Path.Combine(TesterPath, "../../../../TestCases");
|
||||
#if DEBUG
|
||||
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Debug/net10.0");
|
||||
testRunnerBasePath = Path.Combine(TesterPath, $"../../../../../ICSharpCode.Decompiler.TestRunner/bin/Debug/net{CurrentNetCoreVersion}");
|
||||
#else
|
||||
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net10.0");
|
||||
testRunnerBasePath = Path.Combine(TesterPath, $"../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net{CurrentNetCoreVersion}");
|
||||
#endif
|
||||
// To parse: <Project><ItemGroup><PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0-3.final" />
|
||||
packagesPropsFile = Path.Combine(TesterPath, "../../../../../Directory.Packages.props");
|
||||
@@ -136,6 +140,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
await vswhereToolset.Fetch().ConfigureAwait(false);
|
||||
await RefAssembliesToolset.Fetch("5.0.0", sourcePath: "ref/net5.0").ConfigureAwait(false);
|
||||
await RefAssembliesToolset.Fetch("10.0.0", sourcePath: "ref/net10.0").ConfigureAwait(false);
|
||||
await RefAssembliesToolset.Fetch(CurrentNetCoreRefAsmVersion, sourcePath: $"ref/net{CurrentNetCoreVersion}").ConfigureAwait(false);
|
||||
|
||||
#if DEBUG
|
||||
await BuildTestRunner("win-x86", "Debug").ConfigureAwait(false);
|
||||
@@ -341,7 +346,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
|
||||
};
|
||||
|
||||
static readonly Dictionary<string, Lazy<string>> targetFrameworkAttributeSnippetFiles = new() {
|
||||
{ ".NETCoreApp,Version=v10.0", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v10.0")) },
|
||||
{ CurrentNetCoreAppVersion, new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(CurrentNetCoreAppVersion)) },
|
||||
{ ".NETCoreApp,Version=v5.0", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v5.0")) },
|
||||
{ ".NETCoreApp,Version=v2.2", new Lazy<string>(() => GetTargetFrameworkAttributeSnippetFile(".NETCoreApp,Version=v2.2")) },
|
||||
};
|
||||
@@ -454,12 +459,15 @@ namespace System.Runtime.CompilerServices
|
||||
preprocessorSymbols.Add("NET80");
|
||||
preprocessorSymbols.Add("NET90");
|
||||
preprocessorSymbols.Add("NET100");
|
||||
preprocessorSymbols.Add("NET110");
|
||||
}
|
||||
preprocessorSymbols.Add("ROSLYN4");
|
||||
preprocessorSymbols.Add("CS100");
|
||||
preprocessorSymbols.Add("CS110");
|
||||
preprocessorSymbols.Add("CS120");
|
||||
preprocessorSymbols.Add("CS130");
|
||||
preprocessorSymbols.Add("CS140");
|
||||
preprocessorSymbols.Add("CS150");
|
||||
}
|
||||
}
|
||||
else if ((flags & CompilerOptions.UseMcsMask) != 0)
|
||||
@@ -520,7 +528,7 @@ namespace System.Runtime.CompilerServices
|
||||
CompilerOptions.UseRoslyn1_3_2 => ("1.3.2", "6", null),
|
||||
CompilerOptions.UseRoslyn2_10_0 => ("2.10.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v2.2"),
|
||||
CompilerOptions.UseRoslyn3_11_0 => ("3.11.0", "latest", targetNet40 ? null : ".NETCoreApp,Version=v5.0"),
|
||||
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : ".NETCoreApp,Version=v10.0")
|
||||
_ => (roslynLatestVersion, flags.HasFlag(CompilerOptions.Preview) ? "preview" : "latest", targetNet40 ? null : CurrentNetCoreAppVersion)
|
||||
};
|
||||
|
||||
var cscPath = roslynToolset.GetCSharpCompiler(roslynVersion);
|
||||
@@ -770,7 +778,7 @@ namespace System.Runtime.CompilerServices
|
||||
}
|
||||
|
||||
var compilation = CSharpCompilation.Create(Path.GetFileNameWithoutExtension(assemblyName),
|
||||
syntaxTrees, coreDefaultReferences.Select(r => MetadataReference.CreateFromFile(Path.Combine(RefAssembliesToolset.GetPath(".NETCoreApp,Version=v10.0"), r))),
|
||||
syntaxTrees, coreDefaultReferences.Select(r => MetadataReference.CreateFromFile(Path.Combine(RefAssembliesToolset.GetPath(CurrentNetCoreAppVersion), r))),
|
||||
new CSharpCompilationOptions(
|
||||
OutputKind.DynamicallyLinkedLibrary,
|
||||
platform: Platform.AnyCpu,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<TargetFramework>net11.0-windows</TargetFramework>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<RuntimeIdentifier Condition="$(IsWindowsX64) == true">win-x64</RuntimeIdentifier>
|
||||
<RuntimeIdentifier Condition="$(IsWindowsARM64) == true">win-arm64</RuntimeIdentifier>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
<packageSourceMapping>
|
||||
<clear />
|
||||
<packageSource key="nuget.org">
|
||||
<package pattern="*" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
</configuration>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
<packageSourceMapping>
|
||||
<clear />
|
||||
<packageSource key="nuget.org">
|
||||
<package pattern="*" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
</configuration>
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<TargetFramework>net11.0-windows</TargetFramework>
|
||||
<RuntimeIdentifier Condition="$(IsWindowsX64) == true">win-x64</RuntimeIdentifier>
|
||||
<RuntimeIdentifier Condition="$(IsWindowsARM64) == true">win-arm64</RuntimeIdentifier>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0-windows</TargetFramework>
|
||||
<TargetFramework>net11.0-windows</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<RuntimeIdentifier Condition="$(IsWindowsX64) == true">win-x64</RuntimeIdentifier>
|
||||
<RuntimeIdentifier Condition="$(IsWindowsARM64) == true">win-arm64</RuntimeIdentifier>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32014.148
|
||||
# Visual Studio Version 18
|
||||
VisualStudioVersion = 18.4.11620.152 stable
|
||||
MinimumVisualStudioVersion = 15.0
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{F45DB999-7E72-4000-B5AD-3A7B485A0896}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
@@ -42,6 +41,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
Directory.Build.props = Directory.Build.props
|
||||
Directory.Packages.props = Directory.Packages.props
|
||||
global.json = global.json
|
||||
NuGet.config = NuGet.config
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
|
||||
+3
-1
@@ -4,14 +4,15 @@
|
||||
<clear />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
|
||||
<add key="dotnet9-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9-transport/nuget/v3/index.json" />
|
||||
<add key="dotnet10-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet10-transport/nuget/v3/index.json" />
|
||||
<add key="dotnet11-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet11-transport/nuget/v3/index.json" />
|
||||
</packageSources>
|
||||
<packageSourceMapping>
|
||||
<packageSource key="nuget.org">
|
||||
<package pattern="*" />
|
||||
<package pattern="Microsoft.DiaSymReader.Native" />
|
||||
<package pattern="Microsoft.DiaSymReader" />
|
||||
<package pattern="Microsoft.CodeAnalysis.NetAnalyzers" />
|
||||
</packageSource>
|
||||
<packageSource key="dotnet10-transport">
|
||||
<package pattern="ILCompiler.Reflection.ReadyToRun.Experimental" />
|
||||
@@ -19,6 +20,7 @@
|
||||
<packageSource key="dotnet-tools">
|
||||
<package pattern="Microsoft.DiaSymReader.Converter.Xml" />
|
||||
<package pattern="Microsoft.DiaSymReader.PortablePdb" />
|
||||
<package pattern="Microsoft.CodeAnalysis.*" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
</configuration>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "10.0.0",
|
||||
"version": "11.0.0",
|
||||
"rollForward": "major",
|
||||
"allowPrerelease": true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user