소스 검색

移除winform集成

陈国伟 3 년 전
부모
커밋
6b05131cea

+ 2 - 5
Directory.Build.props

@@ -1,12 +1,9 @@
 <Project>
 	<PropertyGroup>
-		<Version>2.0.5</Version>
-		<Nullable>enable</Nullable>
+		<Version>2.0.5</Version>		
 		<Description>github加速神器</Description>
 		<Copyright>https://github.com/dotnetcore/FastGithub</Copyright>
-		<RuntimeIdentifier>win-x64</RuntimeIdentifier>		
-		<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
-		<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
+		<RuntimeIdentifier>win-x64</RuntimeIdentifier>	
 	</PropertyGroup>
 
 	<PropertyGroup Condition="'$(Configuration)'=='Release'">

+ 1 - 0
FastGithub.Configuration/FastGithub.Configuration.csproj

@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>net6.0</TargetFramework>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
   
 	<ItemGroup>

+ 1 - 0
FastGithub.DomainResolve/FastGithub.DomainResolve.csproj

@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>net6.0</TargetFramework>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
   
 	<ItemGroup>

+ 1 - 0
FastGithub.Http/FastGithub.Http.csproj

@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
     <TargetFramework>net6.0</TargetFramework>
+    <Nullable>enable</Nullable>
   </PropertyGroup>
   
 	<ItemGroup>

+ 1 - 0
FastGithub.HttpServer/FastGithub.HttpServer.csproj

@@ -2,6 +2,7 @@
 
 	<PropertyGroup>
     <TargetFramework>net6.0</TargetFramework>
+    <Nullable>enable</Nullable>
 		<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 	</PropertyGroup>
 

+ 1 - 0
FastGithub.PacketIntercept/FastGithub.PacketIntercept.csproj

@@ -2,6 +2,7 @@
 
 	<PropertyGroup>
     <TargetFramework>net6.0</TargetFramework>
+    <Nullable>enable</Nullable>
 		<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 	</PropertyGroup>
 

+ 0 - 7
FastGithub.Upgrade/FastGithub.Upgrade.csproj

@@ -1,7 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>net6.0</TargetFramework>  
-  </PropertyGroup>
-
-</Project>

+ 0 - 13
FastGithub.Windows/FastGithub.Windows.csproj

@@ -1,13 +0,0 @@
-<Project Sdk="Microsoft.NET.Sdk">
-
-  <PropertyGroup>
-    <TargetFramework>net6.0-windows</TargetFramework>
-    <UseWindowsForms>true</UseWindowsForms>
-  </PropertyGroup>
-
-  <ItemGroup>
-    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
-    <PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" /> 
-    <PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
-  </ItemGroup>
-</Project>

+ 0 - 47
FastGithub.Windows/Forms/MainForm.Designer.cs

@@ -1,47 +0,0 @@
-namespace FastGithub.Windows.Forms
-{
-    partial class MainForm
-    {
-        /// <summary>
-        /// Required designer variable.
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// Clean up any resources being used.
-        /// </summary>
-        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows Form Designer generated code
-
-        /// <summary>
-        /// Required method for Designer support - do not modify
-        /// the contents of this method with the code editor.
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.SuspendLayout();
-            // 
-            // MainForm
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(11F, 24F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(800, 450);
-            this.Name = "MainForm";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "FastGithub";
-            this.ResumeLayout(false);
-
-        }
-
-        #endregion
-    }
-}

+ 0 - 20
FastGithub.Windows/Forms/MainForm.cs

@@ -1,20 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace FastGithub.Windows.Forms
-{
-    public partial class MainForm : Form
-    {
-        public MainForm()
-        {
-            InitializeComponent();
-        }
-    }
-}

+ 0 - 60
FastGithub.Windows/Forms/MainForm.resx

@@ -1,60 +0,0 @@
-<root>
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-</root>

+ 0 - 25
FastGithub.Windows/Hosting/ApplicationOptions.cs

@@ -1,25 +0,0 @@
-using System.Windows.Forms;
-
-namespace FastGithub.Windows.Hosting
-{
-    /// <summary>
-    /// 表示Application选项
-    /// </summary>
-    public class ApplicationOptions
-    {
-        /// <summary>
-        /// 获取或设置是否启用VisualStyles
-        /// </summary>
-        public bool EnableVisualStyles { get; set; } = true;
-
-        /// <summary>
-        /// 获取或设置高Dpi的模式
-        /// </summary>
-        public HighDpiMode HighDpiMode { get; set; } = HighDpiMode.SystemAware;
-
-        /// <summary>
-        /// 获取或设置是否兼容TextRendering
-        /// </summary>
-        public bool CompatibleTextRenderingDefault { get; set; } = false;
-    }
-}

+ 0 - 51
FastGithub.Windows/Hosting/IWinFormDispatcher.cs

@@ -1,51 +0,0 @@
-using System;
-using System.Threading;
-
-namespace FastGithub.Windows.Hosting
-{
-    /// <summary>
-    /// WinForm调度器
-    /// </summary>
-    public interface IWinFormDispatcher
-    {
-        /// <summary>
-        /// 获取或设置同步上下文
-        /// </summary>
-        SynchronizationContext? SynchronizationContext { get; set; }
-
-        /// <summary>
-        /// 尝试在同步上下文投递执行委托
-        /// </summary>
-        /// <param name="action"></param>
-        /// <returns></returns>
-        bool TryInvoke(Action action)
-        {
-            var context = this.SynchronizationContext;
-            if (context == null || action == null)
-            {
-                return false;
-            }
-
-            context.Post(state => ((Action)state!)(), action);
-            return false;
-        }
-
-        /// <summary>
-        /// 在同步上下文投递执行委托
-        /// </summary>
-        /// <param name="action"></param>
-        void Invoke(Action action)
-        {
-            var context = this.SynchronizationContext;
-            if (context == null)
-            {
-                throw new InvalidOperationException($"{nameof(SynchronizationContext)} is null");
-            }
-
-            if (action != null)
-            {
-                context.Post(state => ((Action)state!)(), action);
-            }
-        }
-    }
-}

+ 0 - 15
FastGithub.Windows/Hosting/WinFormDispatcher.cs

@@ -1,15 +0,0 @@
-using System.Threading;
-
-namespace FastGithub.Windows.Hosting
-{
-    /// <summary>
-    /// WinForm调度器
-    /// </summary>
-    sealed class WinFormDispatcher : IWinFormDispatcher
-    {
-        /// <summary>
-        /// 获取或设置同步上下文
-        /// </summary>
-        public SynchronizationContext? SynchronizationContext { get; set; }
-    }
-}

+ 0 - 63
FastGithub.Windows/Hosting/WinFormHostBuilderExtensions.cs

@@ -1,63 +0,0 @@
-using FastGithub.Windows.Hosting;
-using Microsoft.Extensions.DependencyInjection;
-using System;
-using System.Windows.Forms;
-
-namespace Microsoft.Extensions.Hosting
-{
-    /// <summary>
-    /// IHostBuilder的WinForm扩展
-    /// </summary>
-    public static class WinFormHostBuilderExtensions
-    {
-        /// <summary>
-        /// 指定WinForm的主窗体
-        /// </summary>
-        /// <remarks>
-        /// * 该方法需要在services.AddHostedService()之前调用
-        /// </remarks>
-        /// <typeparam name="TMainForm"></typeparam>
-        /// <param name="hostBuilder"></param>
-        /// <returns></returns>
-        public static IHostBuilder UseWinForm<TMainForm>(this IHostBuilder hostBuilder) where TMainForm : Form
-        {
-            return hostBuilder.ConfigureServices((context, services) =>
-            {
-                services
-                    .AddSingleton<TMainForm>()
-                    .AddSingleton<IWinFormDispatcher, WinFormDispatcher>()
-                    .AddHostedService<WinFormHostedService<TMainForm>>();
-            });
-        }
-
-        /// <summary>
-        /// 使用WinForm生命周期
-        /// </summary>
-        /// <remarks>
-        /// * 关闭主窗体或调用Appliaction.Exit()之后生命结束
-        /// </remarks>
-        /// <param name="hostBuilder"></param>
-        /// <returns></returns>
-        public static IHostBuilder UseWinFormHostLifetime(this IHostBuilder hostBuilder)
-        {
-            return hostBuilder.UseWinFormHostLifetime(c => { });
-        }
-
-        /// <summary>
-        /// 使用WinForm生命周期
-        /// </summary>
-        /// <remarks>
-        /// * 关闭主窗体或调用Appliaction.Exit()之后生命结束
-        /// </remarks>
-        /// <param name="hostBuilder"></param>
-        /// <param name="configureOptions">Applicaiton选项</param>
-        public static IHostBuilder UseWinFormHostLifetime(this IHostBuilder hostBuilder, Action<ApplicationOptions> configureOptions)
-        {
-            return hostBuilder.ConfigureServices((context, services) =>
-            {
-                services.Configure(configureOptions);
-                services.AddSingleton<IHostLifetime, WinFormHostLifetime>();
-            });
-        }
-    }
-}

+ 0 - 55
FastGithub.Windows/Hosting/WinFormHostLifetime.cs

@@ -1,55 +0,0 @@
-using FastGithub.Windows.Hosting;
-using Microsoft.Extensions.Options;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace Microsoft.Extensions.Hosting
-{
-    /// <summary>
-    /// WinForm生命周期
-    /// </summary>
-    sealed class WinFormHostLifetime : IHostLifetime, IDisposable
-    {
-        private readonly IHostApplicationLifetime applicationLifetime;
-        private readonly IOptions<ApplicationOptions> applicationOptions;
-
-        public WinFormHostLifetime(IHostApplicationLifetime applicationLifetime, IOptions<ApplicationOptions> applicationOptions)
-        {
-            this.applicationLifetime = applicationLifetime;
-            this.applicationOptions = applicationOptions;
-        }
-
-        public Task WaitForStartAsync(CancellationToken cancellationToken)
-        {
-            var option = this.applicationOptions.Value;
-            if (option.EnableVisualStyles == true)
-            {
-                Application.EnableVisualStyles();
-            }
-
-            Application.SetHighDpiMode(option.HighDpiMode);
-            Application.SetCompatibleTextRenderingDefault(option.CompatibleTextRenderingDefault);
-
-            Application.ApplicationExit += OnApplicationExit;
-            return Task.CompletedTask;
-        }
-
-        private void OnApplicationExit(object? sender, System.EventArgs e)
-        {
-            Application.ApplicationExit -= OnApplicationExit;
-            this.applicationLifetime.StopApplication();
-        }
-
-        public Task StopAsync(CancellationToken cancellationToken)
-        {
-            return Task.CompletedTask;
-        }
-
-        public void Dispose()
-        {
-            Application.ApplicationExit -= OnApplicationExit;
-        }
-    }
-}

+ 0 - 88
FastGithub.Windows/Hosting/WinFormHostedService.cs

@@ -1,88 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace FastGithub.Windows.Hosting
-{
-    /// <summary>
-    /// WinForm后台任务和WinForm线程
-    /// </summary>
-    /// <typeparam name="TMainForm"></typeparam>
-    sealed class WinFormHostedService<TMainForm> : IHostedService where TMainForm : Form
-    {
-        private readonly Thread staThread;
-        private readonly IServiceProvider serviceProvider;
-        private readonly TaskCompletionSource taskCompletionSource = new();
-
-        /// <summary>
-        /// WinForm后台任务
-        /// </summary>
-        /// <param name="serviceProvider"></param>
-        public WinFormHostedService(IServiceProvider serviceProvider)
-        {
-            this.serviceProvider = serviceProvider;
-            this.staThread = new Thread(StaRunMainFrom);
-            this.staThread.TrySetApartmentState(ApartmentState.STA);
-        }
-
-        /// <summary>
-        /// 启动
-        /// </summary>
-        /// <param name="cancellationToken"></param>
-        /// <returns></returns>
-        public Task StartAsync(CancellationToken cancellationToken)
-        {
-            this.staThread.Start();
-            return this.taskCompletionSource.Task;
-        }
-
-        /// <summary>
-        /// STA线程
-        /// </summary>
-        private void StaRunMainFrom()
-        {
-            try
-            {
-                var mainForm = this.CreateMainForm();
-                this.taskCompletionSource.TrySetResult();
-                Application.Run(mainForm);
-            }
-            catch (Exception ex)
-            {
-                this.taskCompletionSource.TrySetException(ex);
-            }
-        }
-
-        /// <summary>
-        /// 实例化MainForm与初始化调度器
-        /// </summary>
-        /// <exception cref="InvalidOperationException"></exception>
-        private TMainForm CreateMainForm()
-        {
-            // 在STA线程实例化TMainForm,保证该线程拥有SynchronizationContext
-            var mainForm = this.serviceProvider.GetRequiredService<TMainForm>();
-            if (SynchronizationContext.Current is null)
-            {
-                throw new InvalidOperationException($"不允许在其它线程上实例化{typeof(TMainForm)}");
-            }
-
-            var dispatcher = this.serviceProvider.GetRequiredService<IWinFormDispatcher>();
-            dispatcher.SynchronizationContext = SynchronizationContext.Current;
-            return mainForm;
-        }
-
-        /// <summary>
-        /// 停止
-        /// </summary>
-        /// <param name="cancellationToken"></param>
-        /// <returns></returns>
-        public Task StopAsync(CancellationToken cancellationToken)
-        {
-            Application.Exit();
-            return Task.CompletedTask;
-        }
-    }
-}

+ 0 - 22
FastGithub.Windows/ServiceCollectionExtensions.cs

@@ -1,22 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Logging;
-
-namespace FastGithub
-{
-    /// <summary>
-    /// 服务注册扩展
-    /// </summary>
-    public static class ServiceCollectionExtensions
-    {
-        /// <summary>
-        /// 添加配置服务
-        /// </summary>
-        /// <param name="services"></param> 
-        /// <returns></returns>
-        public static IServiceCollection AddWinForm(this IServiceCollection services)
-        {
-            return services;
-        }
-    }
-}

+ 0 - 12
FastGithub.sln

@@ -15,10 +15,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.HttpServer", "Fa
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.PacketIntercept", "FastGithub.PacketIntercept\FastGithub.PacketIntercept.csproj", "{701FF90C-E651-4E0B-AE7F-84D1F17DD178}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FastGithub.Windows", "FastGithub.Windows\FastGithub.Windows.csproj", "{4F9914B7-2519-46F9-96F1-42400B6BFD6E}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FastGithub.Upgrade", "FastGithub.Upgrade\FastGithub.Upgrade.csproj", "{D644B53B-91E4-41DD-818B-FE3A77ED8D10}"
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -49,14 +45,6 @@ Global
 		{701FF90C-E651-4E0B-AE7F-84D1F17DD178}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{701FF90C-E651-4E0B-AE7F-84D1F17DD178}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{701FF90C-E651-4E0B-AE7F-84D1F17DD178}.Release|Any CPU.Build.0 = Release|Any CPU
-		{4F9914B7-2519-46F9-96F1-42400B6BFD6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{4F9914B7-2519-46F9-96F1-42400B6BFD6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{4F9914B7-2519-46F9-96F1-42400B6BFD6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{4F9914B7-2519-46F9-96F1-42400B6BFD6E}.Release|Any CPU.Build.0 = Release|Any CPU
-		{D644B53B-91E4-41DD-818B-FE3A77ED8D10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{D644B53B-91E4-41DD-818B-FE3A77ED8D10}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{D644B53B-91E4-41DD-818B-FE3A77ED8D10}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{D644B53B-91E4-41DD-818B-FE3A77ED8D10}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 0 - 1
FastGithub/AppHostedService.cs

@@ -1,5 +1,4 @@
 using FastGithub.Configuration;
-using FastGithub.Upgrade;
 using Microsoft.Extensions.Hosting;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Options;

+ 6 - 17
FastGithub/FastGithub.csproj

@@ -1,27 +1,17 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFrameworks>net6.0;net6.0-windows</TargetFrameworks>
+    <TargetFramework>net6.0</TargetFramework>
+    <Nullable>enable</Nullable>
     <AssemblyName>fastgithub</AssemblyName>
     <OutputType>Exe</OutputType>
     <PackageLicenseExpression>MIT</PackageLicenseExpression>
     <IsWebConfigTransformDisabled>true</IsWebConfigTransformDisabled>
     <ApplicationIcon>app.ico</ApplicationIcon>
     <ApplicationManifest>app.manifest</ApplicationManifest>
-  </PropertyGroup>
-
-  <PropertyGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
-    <UseWindowsForms>true</UseWindowsForms>
-    <OutputType>WinExe</OutputType>
-  </PropertyGroup>
-
-  <ItemGroup Condition="'$(TargetFramework)' == 'net6.0-windows'">
-    <ProjectReference Include="..\FastGithub.Windows\FastGithub.Windows.csproj" />
-  </ItemGroup>
-
-  <ItemGroup>
-    <FrameworkReference Include="Microsoft.AspNetCore.App" />
-  </ItemGroup>
+    <DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
+    <EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
+  </PropertyGroup>  
 
   <ItemGroup>
     <PackageReference Include="PInvoke.AdvApi32" Version="0.7.104" />
@@ -29,7 +19,6 @@
     <ProjectReference Include="..\FastGithub.DomainResolve\FastGithub.DomainResolve.csproj" />
     <ProjectReference Include="..\FastGithub.HttpServer\FastGithub.HttpServer.csproj" />
     <ProjectReference Include="..\FastGithub.PacketIntercept\FastGithub.PacketIntercept.csproj" />
-    <ProjectReference Include="..\FastGithub.Upgrade\FastGithub.Upgrade.csproj" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
FastGithub.Upgrade/ProductionVersion.cs → FastGithub/ProductionVersion.cs

@@ -2,7 +2,7 @@
 using System.Reflection;
 using System.Text.RegularExpressions;
 
-namespace FastGithub.Upgrade
+namespace FastGithub
 {
     /// <summary>
     /// 表示产品版本

+ 2 - 6
FastGithub/Program.cs

@@ -26,12 +26,8 @@ namespace FastGithub
         public static IHostBuilder CreateHostBuilder(string[] args)
         {
             return Host
-                .CreateDefaultBuilder(args)
-#if WINDOWS
-                .UseWindowsService()
-                .UseWinForm<Windows.Forms.MainForm>()
-                .UseWinFormHostLifetime()
-#endif
+                .CreateDefaultBuilder(args) 
+                .UseWindowsService()       
                 .UseDefaultServiceProvider(c =>
                 {
                     c.ValidateOnBuild = false;