Target .NET 6

This commit is contained in:
ChsBuffer
2021-11-09 23:40:16 +08:00
parent d01612e840
commit 066e33b4d3
10 changed files with 23 additions and 35 deletions

View File

@@ -37,14 +37,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ contains(github.ref, '-') }}
prerelease: true
draft: false
files: |
Netch.7z
body: |
[![](https://img.shields.io/badge/Telegram-Channel-blue)](https://t.me/netch_channel) [![](https://img.shields.io/badge/Telegram-Group-green)](https://t.me/netch_group)
[**第一次使用请务必先安装 .NET 5.0 运行库**](https://aka.ms/dotnet/5.0/windowsdesktop-runtime-win-x64.exe)
[**第一次使用请务必先安装 .NET 6.0 运行库,不支持 .NET 5.0**](https://aka.ms/dotnet/6.0/windowsdesktop-runtime-win-x64.exe)
## Changelogs
* This is an automated deployment of GitHub Actions, the change log should be updated manually soon

View File

@@ -12,7 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AdditionalFiles", "Addition
.editorconfig = .editorconfig
.gitignore = .gitignore
common.props = common.props
global.json = global.json
LICENSE = LICENSE
README.md = README.md
EndProjectSection

View File

@@ -10,7 +10,6 @@
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>True/PM</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>

View File

@@ -107,7 +107,7 @@ namespace Netch.Forms
if (Global.Settings.StartWhenOpened)
ControlButton.PerformClick();
Program.SingleInstance.ListenForArgumentsFromSuccessiveInstances();
Program.SingleInstance.StartListenServer();
}
private void RecordSize()

View File

@@ -30,10 +30,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HMBSbige.SingleInstance" Version="5.0.7" />
<PackageReference Include="HMBSbige.SingleInstance" Version="6.0.0" />
<PackageReference Include="MaxMind.GeoIP2" Version="4.0.1" />
<PackageReference Include="Microsoft.Diagnostics.Tracing.TraceEvent" Version="2.0.73" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.0.63" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="17.0.64" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.1.588-beta">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
@@ -43,17 +43,16 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="4.1.2" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="4.2.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Stun.Net" Version="5.0.0" />
<PackageReference Include="System.Management" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="6.0.0-rc.2.21480.5" />
<PackageReference Include="Stun.Net" Version="6.0.0" />
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="TaskScheduler" Version="2.9.2" />
<PackageReference Include="WindowsFirewallHelper" Version="2.1.4.81" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="5.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
@@ -78,13 +77,6 @@
<Target Condition="'$(PublishSingleFile)' == 'true'" AfterTargets="_ComputeFilesToBundle" Name="RemoveDupeAssemblies">
<ItemGroup>
<_FilesToBundle Remove="$(PkgMicrosoft_Diagnostics_Tracing_TraceEvent)\build\native\x86\**" />
<!-- .NET 6 SDK fixes MSB4018 "Multiple entries with the same BundleRelativePath",
if still retain the following properties,
you will encounter a "lib/netstandard2.0/Dial2Lib.dll not found" error
-->
<_FilesToBundle Remove="$(PkgMicrosoft_Diagnostics_Tracing_TraceEvent)\lib\netstandard1.6\Dia2Lib.dll" />
<_FilesToBundle Remove="$(PkgMicrosoft_Diagnostics_Tracing_TraceEvent)\lib\netstandard1.6\OSExtensions.dll" />
<_FilesToBundle Remove="$(PkgMicrosoft_Diagnostics_Tracing_TraceEvent)\lib\netstandard1.6\TraceReloggerLib.dll" />
</ItemGroup>
</Target>
</Project>

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -27,7 +26,7 @@ namespace Netch
{
public static class Program
{
public static readonly SingleInstanceService SingleInstance = new($"Global\\{nameof(Netch)}");
public static readonly ISingleInstanceService SingleInstance = new SingleInstanceService($"Global\\{nameof(Netch)}");
internal static HWND ConsoleHwnd { get; private set; }
@@ -70,14 +69,14 @@ namespace Netch
Configuration.LoadAsync().Wait();
// check if the program is already running
if (!SingleInstance.IsFirstInstance)
if (!SingleInstance.TryStartSingleInstance())
{
SingleInstance.PassArgumentsToFirstInstance(args.Append(Constants.Parameter.Show));
SingleInstance.SendMessageToFirstInstanceAsync(Constants.Parameter.Show).GetAwaiter().GetResult();
Environment.Exit(0);
return;
}
SingleInstance.ArgumentsReceived.Subscribe(SingleInstance_ArgumentsReceived);
SingleInstance.Received.Subscribe(SingleInstance_ArgumentsReceived);
// clean up old logs
if (Directory.Exists("logging"))
@@ -108,7 +107,7 @@ namespace Netch
Application.ThreadException += Application_OnException;
Application.ApplicationExit += Application_OnExit;
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.SetHighDpiMode(HighDpiMode.DpiUnawareGdiScaled);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(Global.MainForm);
@@ -207,12 +206,15 @@ namespace Netch
Log.CloseAndFlush();
}
private static void SingleInstance_ArgumentsReceived(IEnumerable<string> args)
private static void SingleInstance_ArgumentsReceived((string, Action<string>) receive)
{
if (args.Contains(Constants.Parameter.Show))
var (arg, endFunc) = receive;
if (arg == Constants.Parameter.Show)
{
Utils.Utils.ActivateVisibleWindows();
}
endFunc(string.Empty);
}
}
}

View File

@@ -32,7 +32,7 @@ Some features may not be implemented in version 1
### Others
- UDP NAT FullCone (May limited by your server)
- .NET 5.0 x64
- .NET 6.0 x64
## Sponsor
<a href="https://www.jetbrains.com/?from=Netch"><img src="https://cdn.jsdelivr.net/gh/netchx/netch/jetbrains.svg" alt="JetBrains" width="200"/></a>

View File

@@ -32,6 +32,7 @@ dotnet publish `
-r 'win-x64' `
-p:Platform='x64' `
-p:SelfContained=$SelfContained `
$('--self-contained', '--no-self-contained')[$SelfContained] `
-p:PublishTrimmed=$False `
-p:PublishReadyToRun=$PublishReadyToRun `
-p:PublishSingleFile=$PublishSingleFile `

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<TargetFramework>net6.0-windows</TargetFramework>
<RuntimeIdentifiers>win-x64</RuntimeIdentifiers>
<Platforms>x64</Platforms>
<LangVersion>latest</LangVersion>

View File

@@ -1,5 +0,0 @@
{
"sdk": {
"allowPrerelease": false
}
}