Browse Source

Move to .NET 8.0 (#3119)

* Basics of net8.0. Breaking unit tests expected.

* Missed that TestRunner project was already upgraded to net7.0 (search and replace fail)

* Use Preview 6 locally

* Use .NET 8.0 RTM

* Final fixups

---------

Co-authored-by: Christoph Wille <christoph.wille@gmail.com>
pull/3122/head
Siegfried Pammer 1 year ago committed by GitHub
parent
commit
a94d66561a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .github/workflows/build-frontends.yml
  2. 17
      .github/workflows/build-ilspy.yml
  3. 6
      .github/workflows/codeql-analysis.yml
  4. 2
      ICSharpCode.Decompiler.TestRunner/ICSharpCode.Decompiler.TestRunner.csproj
  5. 12
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  6. 2
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  7. 8
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs
  8. 2
      ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj
  9. 2
      ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj
  10. 4
      ILSpy.AddIn.VS2022/ILSpy.AddIn.VS2022.csproj
  11. 2
      ILSpy.AddIn/ILSpy.AddIn.csproj
  12. 2
      ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj
  13. 2
      ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj
  14. 2
      ILSpy.Installer/setup.cs
  15. 2
      ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj
  16. 2
      ILSpy.Tests/ILSpy.Tests.csproj
  17. 2
      ILSpy/ILSpy.csproj
  18. 2
      SharpTreeView/ICSharpCode.TreeView.csproj
  19. 2
      TestPlugin/TestPlugin.csproj
  20. 2
      global.json
  21. 6
      publish.ps1

6
.github/workflows/build-frontends.yml

@ -14,10 +14,10 @@ jobs: @@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: '8.0.x'
dotnet-quality: 'ga'
- name: Install dependencies
run: dotnet restore ILSpy.XPlat.slnf

17
.github/workflows/build-ilspy.yml

@ -26,6 +26,11 @@ jobs: @@ -26,6 +26,11 @@ jobs:
submodules: true
fetch-depth: 0
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-quality: 'ga'
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3
@ -48,9 +53,9 @@ jobs: @@ -48,9 +53,9 @@ jobs:
- name: Execute unit tests
run: dotnet test --logger "junit;LogFileName=${{ matrix.configuration }}.xml" --results-directory test-results $env:Tests1 $env:Tests2 $env:Tests3
env:
Tests1: ICSharpCode.Decompiler.Tests\bin\${{ matrix.configuration }}\net6.0-windows\win-x64\ICSharpCode.Decompiler.Tests.dll
Tests2: ILSpy.Tests\bin\${{ matrix.configuration }}\net6.0-windows\ILSpy.Tests.dll
Tests3: ILSpy.BamlDecompiler.Tests\bin\${{ matrix.configuration }}\net6.0-windows\win-x64\ILSpy.BamlDecompiler.Tests.dll
Tests1: ICSharpCode.Decompiler.Tests\bin\${{ matrix.configuration }}\net8.0-windows\win-x64\ICSharpCode.Decompiler.Tests.dll
Tests2: ILSpy.Tests\bin\${{ matrix.configuration }}\net8.0-windows\ILSpy.Tests.dll
Tests3: ILSpy.BamlDecompiler.Tests\bin\${{ matrix.configuration }}\net8.0-windows\win-x64\ILSpy.BamlDecompiler.Tests.dll
- name: Upload Test Logs
uses: actions/upload-artifact@v3
@ -76,7 +81,7 @@ jobs: @@ -76,7 +81,7 @@ jobs:
git diff --exit-code
- name: Zip ILSpy (framework-dependent)
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries.zip .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.dll .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.exe .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.config .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.json .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*\ILSpy.resources.dll .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*\ILSpy.ReadyToRun.Plugin.resources.dll
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries.zip .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.dll .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.exe .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.config .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*.json .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*\ILSpy.resources.dll .\ILSpy\bin\${{ matrix.configuration }}\net8.0-windows\*\ILSpy.ReadyToRun.Plugin.resources.dll
- name: Publish x64/arm64 framework-dependent/self-contained
shell: pwsh
@ -84,11 +89,11 @@ jobs: @@ -84,11 +89,11 @@ jobs:
- name: Zip ILSpy Release (x64 self-contained)
if: matrix.configuration == 'release'
run: 7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net6.0-windows\win-x64\publish\selfcontained\*
run: 7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net8.0-windows\win-x64\publish\selfcontained\*
- name: Zip ILSpy Release (arm64 framework-dependent)
if: matrix.configuration == 'release'
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries_arm64.zip .\ILSpy\bin\Release\net6.0-windows\win-arm64\publish\fwdependent\*
run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries_arm64.zip .\ILSpy\bin\Release\net8.0-windows\win-arm64\publish\fwdependent\*
- name: Build Installer (x64 and arm64, framework-dependent)
if: matrix.configuration == 'release'

6
.github/workflows/codeql-analysis.yml

@ -27,10 +27,10 @@ jobs: @@ -27,10 +27,10 @@ jobs:
with:
languages: ${{ matrix.language }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
dotnet-version: '8.0.x'
dotnet-quality: 'ga'
- name: Build
run: dotnet build ILSpy.XPlat.slnf --configuration Release

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

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

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

@ -105,9 +105,9 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -105,9 +105,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/net7.0");
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Debug/net8.0");
#else
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net7.0");
testRunnerBasePath = Path.Combine(TesterPath, "../../../../../ICSharpCode.Decompiler.TestRunner/bin/Release/net8.0");
#endif
packagesPropsFile = Path.Combine(TesterPath, "../../../../../packages.props");
roslynLatestVersion = XDocument.Load(packagesPropsFile).XPathSelectElement("//RoslynVersion").Value;
@ -270,8 +270,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -270,8 +270,8 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
}
static readonly string coreRefAsmPath = new DotNetCorePathFinder(TargetFrameworkIdentifier.NET,
new Version(7, 0), "Microsoft.NETCore.App")
.GetReferenceAssemblyPath(".NETCoreApp,Version=v7.0");
new Version(8, 0), "Microsoft.NETCore.App")
.GetReferenceAssemblyPath(".NETCoreApp,Version=v8.0");
public static readonly string RefAsmPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
@"Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2");
@ -309,7 +309,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -309,7 +309,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
const string targetFrameworkAttributeSnippet = @"
[assembly: System.Runtime.Versioning.TargetFramework("".NETCoreApp,Version=v7.0"", FrameworkDisplayName = """")]
[assembly: System.Runtime.Versioning.TargetFramework("".NETCoreApp,Version=v8.0"", FrameworkDisplayName = """")]
";
@ -345,6 +345,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -345,6 +345,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
preprocessorSymbols.Add("NETCORE");
preprocessorSymbols.Add("NET60");
preprocessorSymbols.Add("NET70");
preprocessorSymbols.Add("NET80");
}
preprocessorSymbols.Add("ROSLYN");
preprocessorSymbols.Add("CS60");
@ -374,6 +375,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers @@ -374,6 +375,7 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
preprocessorSymbols.Add("ROSLYN4");
preprocessorSymbols.Add("CS100");
preprocessorSymbols.Add("CS110");
preprocessorSymbols.Add("CS120");
}
}
else if ((flags & CompilerOptions.UseMcsMask) != 0)

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

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<IsPackable>false</IsPackable>
<StartupObject>AutoGeneratedProgram</StartupObject>

8
ICSharpCode.Decompiler.Tests/TestCases/Pretty/Switch.cs

@ -1444,7 +1444,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -1444,7 +1444,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
public static bool DoNotRemoveAssignmentBeforeSwitch(string x, out ConsoleKey key)
{
#if NET40 || !ROSLYN
key = (ConsoleKey)0;
#else
key = ConsoleKey.None;
#endif
switch (x)
{
case "A":
@ -1457,7 +1461,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -1457,7 +1461,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
key = ConsoleKey.C;
break;
}
#if NET40 || !ROSLYN
return key != (ConsoleKey)0;
#else
return key != ConsoleKey.None;
#endif
}
public static void Issue1767(string s)

2
ICSharpCode.ILSpyCmd/ICSharpCode.ILSpyCmd.csproj

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ServerGarbageCollection>true</ServerGarbageCollection>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPackable>true</IsPackable>

2
ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<WarningsAsErrors>nullable</WarningsAsErrors>

4
ILSpy.AddIn.VS2022/ILSpy.AddIn.VS2022.csproj

@ -74,8 +74,8 @@ @@ -74,8 +74,8 @@
</ItemGroup>
<PropertyGroup>
<ILSpyBuildPathX64>..\ILSpy\bin\$(Configuration)\net6.0-windows\win-x64\publish\fwdependent\</ILSpyBuildPathX64>
<ILSpyBuildPathArm64>..\ILSpy\bin\$(Configuration)\net6.0-windows\win-arm64\publish\fwdependent\</ILSpyBuildPathArm64>
<ILSpyBuildPathX64>..\ILSpy\bin\$(Configuration)\net8.0-windows\win-x64\publish\fwdependent\</ILSpyBuildPathX64>
<ILSpyBuildPathArm64>..\ILSpy\bin\$(Configuration)\net8.0-windows\win-arm64\publish\fwdependent\</ILSpyBuildPathArm64>
</PropertyGroup>
<Target Name="IncludeILSpyDistributionInVSIXSubFolder" AfterTargets="ResolveProjectReferences">

2
ILSpy.AddIn/ILSpy.AddIn.csproj

@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
</ItemGroup>
<PropertyGroup>
<ILSpyBuildPath>..\ILSpy\bin\$(Configuration)\net6.0-windows\win-x64\publish\fwdependent\</ILSpyBuildPath>
<ILSpyBuildPath>..\ILSpy\bin\$(Configuration)\net8.0-windows\win-x64\publish\fwdependent\</ILSpyBuildPath>
</PropertyGroup>
<Target Name="IncludeILSpyDistributionInVSIXSubFolder" AfterTargets="ResolveProjectReferences">

2
ILSpy.BamlDecompiler.Tests/ILSpy.BamlDecompiler.Tests.csproj

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<IsPackable>false</IsPackable>
<StartupObject>AutoGeneratedProgram</StartupObject>

2
ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>ILSpy.BamlDecompiler.Plugin</AssemblyName>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<IsPackable>false</IsPackable>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>

2
ILSpy.Installer/setup.cs

@ -25,7 +25,7 @@ namespace ILSpy.Installer @@ -25,7 +25,7 @@ namespace ILSpy.Installer
#else
var buildPlatform = "x64";
#endif
var buildOutputDir = $@"ILSpy\bin\{buildConfiguration}\net6.0-windows\win-{buildPlatform}\publish\fwdependent";
var buildOutputDir = $@"ILSpy\bin\{buildConfiguration}\net8.0-windows\win-{buildPlatform}\publish\fwdependent";
var project = new Project("ILSpy",
new InstallDir(@"%LocalAppData%\Programs\ILSpy",

2
ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>ILSpy.ReadyToRun.Plugin</AssemblyName>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<NeutralResourcesLanguage>en-US</NeutralResourcesLanguage>

2
ILSpy.Tests/ILSpy.Tests.csproj

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<IsPackable>false</IsPackable>
<StartupObject>AutoGeneratedProgram</StartupObject>

2
ILSpy/ILSpy.csproj

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>

2
SharpTreeView/ICSharpCode.TreeView.csproj

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
<UseWpf>true</UseWpf>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<SignAssembly>True</SignAssembly>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<AssemblyOriginatorKeyFile>..\ICSharpCode.Decompiler\ICSharpCode.Decompiler.snk</AssemblyOriginatorKeyFile>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>

2
TestPlugin/TestPlugin.csproj

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<AssemblyName>Test.Plugin</AssemblyName>
<UseWpf>true</UseWpf>
<EnableWindowsTargeting>true</EnableWindowsTargeting>

2
global.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.100",
"version": "8.0.100",
"rollForward": "major",
"allowPrerelease": true
}

6
publish.ps1

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
$output_arm64 = "./ILSpy/bin/Release/net6.0-windows/win-arm64/publish/fwdependent"
$output_x64 = "./ILSpy/bin/Release/net6.0-windows/win-x64/publish/fwdependent"
$output_x64_selfcontained = "./ILSpy/bin/Release/net6.0-windows/win-x64/publish/selfcontained"
$output_arm64 = "./ILSpy/bin/Release/net8.0-windows/win-arm64/publish/fwdependent"
$output_x64 = "./ILSpy/bin/Release/net8.0-windows/win-x64/publish/fwdependent"
$output_x64_selfcontained = "./ILSpy/bin/Release/net8.0-windows/win-x64/publish/selfcontained"
dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64
dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64

Loading…
Cancel
Save