Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

迁移至.NET 6 #5

Merged
merged 17 commits into from
Jun 10, 2022
Merged

迁移至.NET 6 #5

merged 17 commits into from
Jun 10, 2022

Conversation

Yushu2606
Copy link

No description provided.

Program.cs Outdated Show resolved Hide resolved
@Zaitonn
Copy link
Member

Zaitonn commented Jun 9, 2022

net的版本选5.x

@Yushu2606
Copy link
Author

net的版本选5.x

为什么

@Yushu2606 Yushu2606 changed the title .NET 6 迁移至.NET 6 Jun 9, 2022
@Zaitonn
Copy link
Member

Zaitonn commented Jun 9, 2022

net的版本选5.x

为什么

算了那也行

@Zaitonn
Copy link
Member

Zaitonn commented Jun 9, 2022

顺便请教一下,为什么用net6编译出来是散装的,而原来4.7.2不会👉🏻👈🏻

@Yushu2606
Copy link
Author

Yushu2606 commented Jun 9, 2022

顺便请教一下,为什么用net6编译出来是散装的,而原来net4不会👉🏻👈🏻

迁移时自动加了几个Nuget包,现已移除
仅需发布Serein.dllSerein.exeSerein.runtimeconfig.json文件,其他文件可以忽略

Copy link
Member

@Zaitonn Zaitonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

太长的if语句不要用三元替换 短一点的无所谓

@Yushu2606 Yushu2606 requested a review from Zaitonn June 9, 2022 11:22
@Yushu2606
Copy link
Author

不是,都return了还干嘛else……

@Zaitonn
Copy link
Member

Zaitonn commented Jun 9, 2022

我是傻逼 这就去改回来

不是,都return了还干嘛else……

Copy link
Member

@Zaitonn Zaitonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

个人感觉还是用net4.7.2的好,毕竟是win10自带的库也比较方便,所以还请麻烦改一下

@Yushu2606
Copy link
Author

Yushu2606 commented Jun 9, 2022

image

个人感觉还是用net4.7.2的好,毕竟是win10自带的库也比较方便,所以还请麻烦改一下

用.NET 6.0的原因详见 https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-6/ 部分情况下.NET 6能比.NET 4快100倍
而且你这没装.NET 6.0桌面运行时吧

@Zaitonn
Copy link
Member

Zaitonn commented Jun 9, 2022

image
个人感觉还是用net4.7.2的好,毕竟是win10自带的库也比较方便,所以还请麻烦改一下

用.NET 6.0的原因详见 https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-6/ 部分情况下.NET 6能比.NET 4快100倍 而且你这没装.NET 6.0桌面运行时吧

是的没装,但是我的意思是出于方便发布和使用考虑,本身是想弄成一般下载即可使用而不需要另外装运行库👉👈
而且……

已启动生成...
------ 已启动生成: 项目: Serein, 配置: Debug Any CPU ------
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\Ui\GetInfo.cs(99,39,99,61): warning SYSLIB0014: “WebRequest.Create(string)”已过时:“WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.”
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\baseFunction\Server.cs(286,13,286,38): warning SYSLIB0006: “Thread.Abort()”已过时:“Thread.Abort is not supported and throws PlatformNotSupportedException.”
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\baseFunction\Server.cs(322,13,322,39): warning SYSLIB0006: “Thread.Abort()”已过时:“Thread.Abort is not supported and throws PlatformNotSupportedException.”
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\baseFunction\Server.cs(332,13,332,41): warning SYSLIB0006: “Thread.Abort()”已过时:“Thread.Abort is not supported and throws PlatformNotSupportedException.”
MSBUILD : warning FodyPackageReference: Fody: The package reference for Costura.Fody is missing the 'compile' part in the IncludeAssets setting; it's recommended to completely remove IncludeAssets
Serein -> C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\bin\Debug\net6.0-windows\Serein.dll
已完成生成项目“Serein.csproj”的操作。
========== “生成”: 1 成功,0 失败,0 更新,0 已跳过 ==========

会崩

@Yushu2606
Copy link
Author

Yushu2606 commented Jun 9, 2022

image
个人感觉还是用net4.7.2的好,毕竟是win10自带的库也比较方便,所以还请麻烦改一下

用.NET 6.0的原因详见 https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-6/ 部分情况下.NET 6能比.NET 4快100倍 而且你这没装.NET 6.0桌面运行时吧

是的没装,但是我的意思是出于方便发布和使用考虑,本身是想弄成一般下载即可使用而不需要另外装运行库👉👈 而且……

已启动生成...
------ 已启动生成: 项目: Serein, 配置: Debug Any CPU ------
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\Ui\GetInfo.cs(99,39,99,61): warning SYSLIB0014: “WebRequest.Create(string)”已过时:“WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.”
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\baseFunction\Server.cs(286,13,286,38): warning SYSLIB0006: “Thread.Abort()”已过时:“Thread.Abort is not supported and throws PlatformNotSupportedException.”
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\baseFunction\Server.cs(322,13,322,39): warning SYSLIB0006: “Thread.Abort()”已过时:“Thread.Abort is not supported and throws PlatformNotSupportedException.”
C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\baseFunction\Server.cs(332,13,332,41): warning SYSLIB0006: “Thread.Abort()”已过时:“Thread.Abort is not supported and throws PlatformNotSupportedException.”
MSBUILD : warning FodyPackageReference: Fody: The package reference for Costura.Fody is missing the 'compile' part in the IncludeAssets setting; it's recommended to completely remove IncludeAssets
Serein -> C:\Users\Administrator\Desktop\Serein-main (1)\Serein-main\bin\Debug\net6.0-windows\Serein.dll
已完成生成项目“Serein.csproj”的操作。
========== “生成”: 1 成功,0 失败,0 更新,0 已跳过 ==========

会崩

单一文件发布详见 https://docs.microsoft.com/dotnet/core/deploying/single-file/overview

下面的是因为你原本用的方法在新版被弃用了,现已修复

Copy link
Member

@Zaitonn Zaitonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这几个地方其实没必要改成task吧 毕竟不用abort
顺便请教一下,如果task执行完不管他是不是也没啥问题(就是说是不是没必要cancel掉

@Yushu2606
Copy link
Author

这几个地方其实没必要改成task吧 毕竟不用abort

顺便请教一下,如果task执行完不管他是不是也没啥问题(就是说是不是没必要cancel掉

  1. 改Task是为了未来可能的需求
  2. 理应不用管,GC会自己回收

@Zaitonn Zaitonn merged commit a4ac366 into SereinDev:main Jun 10, 2022
@Zaitonn
Copy link
Member

Zaitonn commented Jun 11, 2022

出于方便考虑我可能还是会把版本降回去……您所说的速度更快目前来看暂时没什么影响……不好意思哈orz

@Yushu2606
Copy link
Author

Yushu2606 commented Jun 11, 2022

出于方便考虑我可能还是会把版本降回去……您所说的速度更快目前来看暂时没什么影响……不好意思哈orz

你不知道有多版本编译吗,,

@Zaitonn
Copy link
Member

Zaitonn commented Jun 11, 2022

出于方便考虑我可能还是会把版本降回去……您所说的速度更快目前来看暂时没什么影响……不好意思哈orz

你不知道有多版本编译吗,,

请问怎么弄👀

@Zaitonn
Copy link
Member

Zaitonn commented Jun 11, 2022

761F8725-0C45-410C-8B84-A36352F1A7A4
这咋办

@Yushu2606
Copy link
Author

出于方便考虑我可能还是会把版本降回去……您所说的速度更快目前来看暂时没什么影响……不好意思哈orz

你不知道有多版本编译吗,,

请问怎么弄👀

https://docs.microsoft.com/zh-cn/dotnet/core/porting/project-structure

@Yushu2606
Copy link
Author

761F8725-0C45-410C-8B84-A36352F1A7A4 这咋办

csproj没改对,它都写出来了

@Zaitonn
Copy link
Member

Zaitonn commented Jun 12, 2022

谢谢,这个解决了,可以编译了
但是再请教一下
运行4.7.2的会报错但是6.0不会是为什么

2022/6/12 13:02:57  |  v1.2.3
System.Resources.MissingManifestResourceException: 未能找到任何适合于指定的区域性或非特定区域性的资源。请确保在编译时已将“Serein.Ui.resources”正确嵌入或链接到程序集“Serein”,或者确保所有需要的附属程序集都可加载并已进行了完全签名。
   在 System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
   在 System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   在 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   在 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   在 System.Resources.ResourceManager.GetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
   在 Serein.Ui.InitializeComponent()
   在 Serein.Ui..ctor()
   在 Serein.Program.Main()
===============================================

这个是咋了

@Yushu2606
Copy link
Author

Yushu2606 commented Jun 12, 2022

谢谢,这个解决了,可以编译了 但是再请教一下 运行4.7.2的会报错但是6.0不会是为什么

2022/6/12 13:02:57  |  v1.2.3
System.Resources.MissingManifestResourceException: 未能找到任何适合于指定的区域性或非特定区域性的资源。请确保在编译时已将“Serein.Ui.resources”正确嵌入或链接到程序集“Serein”,或者确保所有需要的附属程序集都可加载并已进行了完全签名。
   在 System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
   在 System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
   在 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
   在 System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   在 System.Resources.ResourceManager.GetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.FillResources(CultureInfo culture, ResourceSet& resourceSet)
   在 System.ComponentModel.ComponentResourceManager.ApplyResources(Object value, String objectName, CultureInfo culture)
   在 Serein.Ui.InitializeComponent()
   在 Serein.Ui..ctor()
   在 Serein.Program.Main()
===============================================

这个是咋了

https://docs.microsoft.com/zh-cn/dotnet/api/system.resources.missingmanifestresourceexception

@Yushu2606
Copy link
Author

要懂得查doc

@Zaitonn
Copy link
Member

Zaitonn commented Jun 12, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants