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 core项目发布成单文件的问题 #50

Open
dengliyan opened this issue Apr 10, 2024 · 0 comments
Open

.net core项目发布成单文件的问题 #50

dengliyan opened this issue Apr 10, 2024 · 0 comments

Comments

@dengliyan
Copy link

程序在启动的时候,检测是否更新,有更新会强制更新,程序启动后有一个手动检测更新,
有更新会使用命令行的形式调用.exe进行更新。
由于两段逻辑是一样,于是将检测的逻辑单独封装成如下代码
但是 .net core的项目发布成单文件的项目,程序启动会报单文件那个错误,而手动检测不会。
是否可以将源码中那个单文件的异常直接关闭?

var updater = FSLib.App.SimpleUpdater.Updater.CreateUpdaterInstance(Config.UpdaterURI);
updater.DownloadUpdateInfoFinished += (e, a) =>
{
updater.Context.EnableEmbedDialog = false;
updater.Context.ForceUpdate = false;
updater.Context.MustUpdate = false;
updater.Context.UpdateInfo.ForceUpdate = false;
updater.Context.UpdateInfo.MustUpdate = false;
};
updater.UpdateError += (e, a) => { };
updater.UpdatesAvailable += (e, a) =>
{
var message = "将升级 {0} (版本 {1}) 到 版本 {2},请等待升级完成。";
var buttons = MessageBoxButtons.OKCancel;
if (!ManualCheckUpdate)
{
message = "将升级 {0} (版本 {1}) 到 版本 {2},请等待升级完成。\r\n\r\n如果无法升级,软件将无法使用。";
buttons = MessageBoxButtons.OK;
}
var dialog = MessageBox.Show(
string.Format(
message,
updater.Context.UpdateInfo.AppName,
updater.Context.CurrentVersion,
updater.Context.UpdateInfo.AppVersion),
"信息",
buttons,
MessageBoxIcon.Information);
if (dialog == DialogResult.OK)
{
StartExternalUpdater();
}
};

Repository owner deleted a comment from lianglj May 15, 2024
Repository owner deleted a comment from findersky May 15, 2024
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

No branches or pull requests

1 participant