Migrate to net8

This commit is contained in:
Ben Olden-Cooligan 2023-11-18 11:43:50 -08:00
parent 3d9f8f4340
commit 61aebe6c8c
32 changed files with 52 additions and 52 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6-windows;net462</TargetFrameworks>
<TargetFrameworks>net8-windows;net462</TargetFrameworks>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<OutputType>Exe</OutputType>
<AppConfig>app.config</AppConfig>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<TargetFramework>net8</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>NAPS2</RootNamespace>
<AssemblyName>naps2</AssemblyName>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7-macos10.15</TargetFramework>
<TargetFramework>net8-macos10.15</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>NAPS2</RootNamespace>
<AssemblyName>NAPS2</AssemblyName>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net462</TargetFrameworks>
<TargetFrameworks>net8;net462</TargetFrameworks>
<OutputType>WinExe</OutputType>
<RootNamespace>NAPS2.Portable</RootNamespace>
<AssemblyName>NAPS2.Portable</AssemblyName>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<TargetFramework>net8</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<Configurations>Debug;Release;DebugLang</Configurations>

View File

@ -12,7 +12,7 @@ public class LinuxAppTestTarget : IAppTestTarget
{
var runtime = RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "linux-arm64" : "linux-x64";
return new AppTestExe(
Path.Combine(AppTestHelper.SolutionRoot, "NAPS2.App.Gtk", "bin", "Debug", "net6", runtime),
Path.Combine(AppTestHelper.SolutionRoot, "NAPS2.App.Gtk", "bin", "Debug", "net8", runtime),
"naps2",
argPrefix);
}

View File

@ -9,7 +9,7 @@ public class MacAppTestTarget : IAppTestTarget
private AppTestExe GetAppTestExe(string argPrefix)
{
return new AppTestExe(
Path.Combine(AppTestHelper.SolutionRoot, "NAPS2.App.Mac", "bin", "Debug", "net7-macos10.15"),
Path.Combine(AppTestHelper.SolutionRoot, "NAPS2.App.Mac", "bin", "Debug", "net8-macos10.15"),
Path.Combine("NAPS2.app", "Contents", "MacOS", "NAPS2"),
argPrefix);
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6-windows;net462</TargetFrameworks>
<TargetFrameworks>net8-windows;net462</TargetFrameworks>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<OutputType>WinExe</OutputType>
<AppConfig>app.config</AppConfig>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6-windows;net462</TargetFrameworks>
<TargetFrameworks>net8-windows;net462</TargetFrameworks>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<OutputType>WinExe</OutputType>
<LargeAddressAware>true</LargeAddressAware>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net6-macos10.15</TargetFrameworks>
<TargetFrameworks>net6;net8-macos10.15</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
@ -32,7 +32,7 @@
<Using Include="MonoMac.MobileCoreServices" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6-macos10.15'">
<ItemGroup Condition="'$(TargetFramework)' == 'net8-macos10.15'">
<Using Include="AppKit" />
<Using Include="CoreGraphics" />
<Using Include="Foundation" />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6</TargetFrameworks>
<TargetFrameworks>net8</TargetFrameworks>
<Nullable>enable</Nullable>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<RootNamespace>NAPS2</RootNamespace>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7-macos10.15</TargetFrameworks>
<TargetFrameworks>net8-macos10.15</TargetFrameworks>
<Nullable>enable</Nullable>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<RootNamespace>NAPS2</RootNamespace>

View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net6;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net6</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net8;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net8</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>NAPS2.Lib.Tests</RootNamespace>
</PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6-windows;net462</TargetFrameworks>
<TargetFrameworks>net8-windows;net462</TargetFrameworks>
<Nullable>enable</Nullable>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<RootNamespace>NAPS2</RootNamespace>

View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Linux'))">net6;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Linux'))">net6;net6-macos10.15;net462</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Linux'))">net8;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Linux'))">net8;net8-macos10.15;net462</TargetFrameworks>
<Nullable>enable</Nullable>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
<RootNamespace>NAPS2</RootNamespace>
@ -15,7 +15,7 @@
<Import Project="..\NAPS2.Setup\targets\CommonTargets.targets" />
<Import Project="..\NAPS2.Setup\targets\LibUsers.targets" />
<PropertyGroup Condition="'$(TargetFramework)' == 'net6-macos10.15'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net8-macos10.15'">
<DefineConstants>MAC</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release-Msi'">

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net462</TargetFrameworks>
<TargetFrameworks>net8;net462</TargetFrameworks>
<!-- As these are just samples, no need for "windows only api" warnings for GdiImageContext -->
<NoWarn>CA1416</NoWarn>
</PropertyGroup>

View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net6;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net6</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net8;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net8</TargetFrameworks>
<RootNamespace>NAPS2.Sdk.ScannerTests</RootNamespace>
</PropertyGroup>

View File

@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net6;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net6</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net8;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net8</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
@ -27,7 +27,7 @@
<ProjectReference Include="..\NAPS2.Images.Wpf\NAPS2.Images.Wpf.csproj" Condition="$([MSBuild]::IsOSPlatform('Windows'))" />
<ProjectReference Include="..\NAPS2.Images.Mac\NAPS2.Images.Mac.csproj" Condition="$([MSBuild]::IsOSPlatform('OSX'))" />
<ProjectReference Include="..\NAPS2.Images.Gtk\NAPS2.Images.Gtk.csproj" Condition="$([MSBuild]::IsOSPlatform('Linux'))" />
<ProjectReference Include="..\NAPS2.Images.ImageSharp\NAPS2.Images.ImageSharp.csproj" Condition="'$(TargetFramework)' == 'net6'" />
<ProjectReference Include="..\NAPS2.Images.ImageSharp\NAPS2.Images.ImageSharp.csproj" Condition="'$(TargetFramework)' == 'net8'" />
<PackageReference Include="NAPS2.Pdfium.Binaries" Version="1.0.1" />
<PackageReference Include="NAPS2.Tesseract.Binaries" Version="1.1.0" />

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<TargetFramework>net8</TargetFramework>
<OutputType>WinExe</OutputType>
<LargeAddressAware>true</LargeAddressAware>
<RootNamespace>NAPS2.Sdk.Worker</RootNamespace>

View File

@ -18,7 +18,7 @@
<ItemGroup>
<Compile Remove="*.*" />
<Content Include="NAPS2.Sdk.Worker.Win32.targets" PackagePath="build/NAPS2.Sdk.Worker.Win32.targets" />
<None Include="bin\Release\net6\win-x86\publish\NAPS2.Worker.exe">
<None Include="bin\Release\net8\win-x86\publish\NAPS2.Worker.exe">
<Link>lib/NAPS2.Worker.exe</Link>
<Pack>true</Pack>
<PackageCopyToOutput>true</PackageCopyToOutput>

View File

@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>net6;net462</TargetFrameworks>
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Linux')) and '$(Configuration)' != 'DebugNoMac'">
$(TargetFrameworks);net6-macos10.15
$(TargetFrameworks);net8-macos10.15
</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@ -22,7 +22,7 @@
<Import Project="..\NAPS2.Setup\targets\SdkUsers.targets" />
<Import Project="..\NAPS2.Setup\targets\SdkPackageTargets.targets" />
<PropertyGroup Condition="'$(TargetFramework)' == 'net6-macos10.15'">
<PropertyGroup Condition="'$(TargetFramework)' == 'net8-macos10.15'">
<DefineConstants>MAC</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(AddDebugConstant)' == '1'">
@ -37,14 +37,14 @@
<HintPath>..\NAPS2.Setup\lib\PdfSharpCore.dll</HintPath>
</Reference>
<!-- TODO: Switch back to the official nuget if https://github.com/soukoku/ntwain/pull/35 gets merged -->
<Reference Include="NTwain" Condition="'$(TargetFramework)' != 'net6-macos10.15'">
<Reference Include="NTwain" Condition="'$(TargetFramework)' != 'net8-macos10.15'">
<HintPath>..\NAPS2.Setup\lib\NTwain.dll</HintPath>
</Reference>
<PackageReference Include="Grpc.Tools" Version="2.47.0" PrivateAssets="all" />
<PackageReference Include="GrpcDotNetNamedPipes" Version="2.0.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" Condition="'$(TargetFramework)' != 'net6-macos10.15'" />
<PackageReference Include="NAPS2.Wia" Version="2.0.3" Condition="'$(TargetFramework)' != 'net6-macos10.15'" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" Condition="'$(TargetFramework)' != 'net8-macos10.15'" />
<PackageReference Include="NAPS2.Wia" Version="2.0.3" Condition="'$(TargetFramework)' != 'net8-macos10.15'" />
<!-- Hide compatibility warnings for NTwain as it will only be actually used on Windows. -->
<!-- TODO: Does this actually work if we build a net6 framework-dependent app and try to use Twain? -->
<!-- <PackageReference Include="NTwain" Version="3.7.1" NoWarn="NU1701" Condition="'$(TargetFramework)' != 'net6-macos10.15'" />-->
@ -87,7 +87,7 @@
<ItemGroup>
<ProjectReference Include="..\NAPS2.Escl\NAPS2.Escl.csproj" />
<ProjectReference Include="..\NAPS2.Escl.Server\NAPS2.Escl.Server.csproj" />
<ProjectReference Include="..\NAPS2.Images.Mac\NAPS2.Images.Mac.csproj" Condition="'$(TargetFramework)' == 'net6-macos10.15'" />
<ProjectReference Include="..\NAPS2.Images.Mac\NAPS2.Images.Mac.csproj" Condition="'$(TargetFramework)' == 'net8-macos10.15'" />
<ProjectReference Include="..\NAPS2.Images\NAPS2.Images.csproj" />
<ProjectReference Include="..\NAPS2.Internals\NAPS2.Internals.csproj" />
</ItemGroup>

View File

@ -24,7 +24,7 @@ public enum Driver
/// <summary>
/// Use an Apple ImageCaptureCore driver (Mac-only). You will also need to compile against a macOS framework target
/// (e.g net6-macos10.15) to use this driver type.
/// (e.g net8-macos10.15) to use this driver type.
/// </summary>
Apple,

View File

@ -37,7 +37,7 @@ internal class ScanDriverFactory : IScanDriverFactory
default:
throw new NotSupportedException(
$"Unsupported driver: {options.Driver}. " +
"Make sure you're using the right framework target (e.g. net6-macos10.15 for the Apple driver).");
"Make sure you're using the right framework target (e.g. net8-macos10.15 for the Apple driver).");
}
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6;net462</TargetFrameworks>
<TargetFrameworks>net8;net462</TargetFrameworks>
</PropertyGroup>
<Import Project="..\NAPS2.Setup\targets\CommonTargets.targets" />

View File

@ -3,7 +3,7 @@ runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.dotnet6
- org.freedesktop.Sdk.Extension.dotnet8
command: naps2
copy-icon: true
cleanup:
@ -81,10 +81,10 @@ modules:
- name: main
buildsystem: simple
build-options:
append-path: /usr/lib/sdk/dotnet6/bin
append-ld-library-path: /usr/lib/sdk/dotnet6/lib
append-path: /usr/lib/sdk/dotnet8/bin
append-ld-library-path: /usr/lib/sdk/dotnet8/lib
env:
PKG_CONFIG_PATH: /app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/lib/dotnet6/lib/pkgconfig
PKG_CONFIG_PATH: /app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig:/usr/lib/dotnet8/lib/pkgconfig
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 'true'
arch:
@ -97,7 +97,7 @@ modules:
build-commands:
- mkdir -p /app/bin
- dotnet publish NAPS2.App.Gtk -c Release -r $RUNTIME --self-contained /p:DebugType=None /p:DebugSymbols=false --source ./nuget-sources
- cp -r --remove-destination /run/build/main/NAPS2.App.Gtk/bin/Release/net6/$RUNTIME/publish/. /app/bin/
- cp -r --remove-destination /run/build/main/NAPS2.App.Gtk/bin/Release/net8/$RUNTIME/publish/. /app/bin/
- install -Dm644 com.naps2.Naps2.png /app/share/icons/hicolor/128x128/apps/com.naps2.Naps2.png
- install -Dm644 com.naps2.Naps2.metainfo.xml /app/share/metainfo/com.naps2.Naps2.metainfo.xml
- install -Dm644 com.naps2.Naps2.desktop /app/share/applications/com.naps2.Naps2.desktop

View File

@ -36,10 +36,10 @@ def main():
'--env=DOTNET_CLI_TELEMETRY_OPTOUT=true',
'--env=DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true',
'--command=sh', '--runtime=org.freedesktop.Sdk//22.08', '--share=network',
'--filesystem=host', 'org.freedesktop.Sdk.Extension.dotnet6//22.08', '-c',
'PATH="${PATH}:/usr/lib/sdk/dotnet6/bin" NUGET_PACKAGES="' +
'--filesystem=host', 'org.freedesktop.Sdk.Extension.dotnet8//22.08', '-c',
'PATH="${PATH}:/usr/lib/sdk/dotnet8/bin" NUGET_PACKAGES="' +
str(Path(tmp).resolve()) +
'" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/sdk/dotnet6/lib" exec dotnet ' + cmd,
'" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/sdk/dotnet8/lib" exec dotnet ' + cmd,
'--', args.project] + runtime_args)
runCommand('restore -r linux-x64 "$@"')

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7</TargetFramework>
<TargetFramework>net8</TargetFramework>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RootNamespace>NAPS2.Tools</RootNamespace>

View File

@ -33,7 +33,7 @@ public static class DebPackager
File.WriteAllText(Path.Combine(controlDir, "control"), template);
// Copy binary files
var publishDir = Path.Combine(Paths.SolutionRoot, "NAPS2.App.Gtk", "bin", "Release", "net6", runtimeId,
var publishDir = Path.Combine(Paths.SolutionRoot, "NAPS2.App.Gtk", "bin", "Release", "net8", runtimeId,
"publish");
var targetDir = Path.Combine(workingDir, "usr/lib/naps2");
ProjectHelper.CopyDirectory(publishDir, targetDir);

View File

@ -14,7 +14,7 @@ public static class MacPackager
Output.Info($"Packaging installer: {pkgPath}");
Output.Verbose("Building bundle");
var basePath = Path.Combine(Paths.SolutionRoot, "NAPS2.App.Mac", "bin", "Release", "net7-macos10.15");
var basePath = Path.Combine(Paths.SolutionRoot, "NAPS2.App.Mac", "bin", "Release", "net8-macos10.15");
string bundlePath = packageInfo.Platform switch
{
Platform.Mac => Path.Combine(basePath, "NAPS2.app"),

View File

@ -29,5 +29,5 @@ public class PackageOptions : OptionsBase
[Option("debug", Required = false, HelpText = "Set DEBUG compile-time constant. Requires --build.")]
public bool Debug { get; set; }
// TODO: Add net target (net462/net6/net6-windows etc.)
// TODO: Add net target (net462/net8/net8-windows etc.)
}

View File

@ -36,7 +36,7 @@ public static class RpmPackager
File.WriteAllText(Path.Combine(workingDir, "SPECS/naps2.spec"), template);
// Copy binary files
var publishDir = Path.Combine(Paths.SolutionRoot, "NAPS2.App.Gtk", "bin", "Release", "net6", runtimeId,
var publishDir = Path.Combine(Paths.SolutionRoot, "NAPS2.App.Gtk", "bin", "Release", "net8", runtimeId,
"publish");
var filesDir = Path.Combine(workingDir, $"naps2-{pkgInfo.VersionNumber}");
var targetDir = Path.Combine(filesDir, "usr/lib/naps2");

View File

@ -9,11 +9,11 @@ public class TestCommand : ICommand<TestOptions>
// TODO: Framework options (e.g. "-f net462")
var arch = RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant();
var depsRootPath = OperatingSystem.IsMacOS()
? $"NAPS2.App.Mac/bin/Debug/net7-macos10.15/osx-{arch}"
? $"NAPS2.App.Mac/bin/Debug/net8-macos10.15/osx-{arch}"
: OperatingSystem.IsLinux()
? $"NAPS2.App.Gtk/bin/Debug/net6/linux-{arch}"
? $"NAPS2.App.Gtk/bin/Debug/net8/linux-{arch}"
: "NAPS2.App.WinForms/bin/Debug/net462";
var frameworkArg = OperatingSystem.IsWindows() ? "" : "-f net6";
var frameworkArg = OperatingSystem.IsWindows() ? "" : "-f net8";
void RunTests(string project, bool isRetry = false)
{