2

我正在尝试通过 Squirrel 分发我的 C# 应用程序。通过 Squirrel 发布,我创建了一个安装程序 exe 来安装它。其中大部分工作 - 安装程序提取我的应用程序的文件并启动应用程序(当前版本为 0.0.1)。

完成后,%localappdata%\MyApp 确实包含“app-0.0.1”子文件夹及其所有数据,并且在其根文件夹中还包含一个 Update.exe。但是,主文件夹中没有 MyApp.exe,即:

  • %localappdata%\MyApp\app-0.0.1\MyApp.exe 存在,但是
  • %localappdata%\MyApp\MyApp.exe 不存在。

我在任何地方都看不到任何错误消息 - 有人知道那里发生了什么吗?松鼠的日志说:


2018-03-14 13:47:56> Program: Starting Squirrel Updater: --install .
2018-03-14 13:47:56> Program: Starting install, writing to C:\Users\MyUsername\AppData\Local\SquirrelTemp
2018-03-14 13:47:56> Program: About to install to: C:\Users\MyUsername\AppData\Local\MyApp
2018-03-14 13:47:56> CheckForUpdateImpl: Couldn't write out staging user ID, this user probably shouldn't get beta anything: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\MyUsername\AppData\Local\MyApp\packages\.betaId'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)
   at System.IO.File.WriteAllText(String path, String contents, Encoding encoding)
   at Squirrel.UpdateManager.CheckForUpdateImpl.getOrCreateStagedUserId()
2018-03-14 13:47:56> CheckForUpdateImpl: Failed to load local releases, starting from scratch: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\MyUsername\AppData\Local\MyApp\packages\RELEASES'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Squirrel.Utility.LoadLocalReleases(String localReleaseFile)
   at Squirrel.UpdateManager.CheckForUpdateImpl.<CheckForUpdate>d__2.MoveNext()
2018-03-14 13:47:56> CheckForUpdateImpl: Reading RELEASES file from C:\Users\MyUsername\AppData\Local\SquirrelTemp
2018-03-14 13:47:56> CheckForUpdateImpl: First run or local directory is corrupt, starting from scratch
2018-03-14 13:47:56> ApplyReleasesImpl: Writing files to app directory: C:\Users\MyUsername\AppData\Local\MyApp\app-0.0.1
2018-03-14 13:47:57> ApplyReleasesImpl: Squirrel Enabled Apps: [C:\Users\MyUsername\AppData\Local\MyApp\app-0.0.1\MyApp.exe]
2018-03-14 13:47:59> ApplyReleasesImpl: Starting fixPinnedExecutables
2018-03-14 13:47:59> ApplyReleasesImpl: Examining Pin: Internet Explorer.lnk
2018-03-14 13:47:59> ApplyReleasesImpl: Examining Pin: Outlook 2013.lnk
2018-03-14 13:47:59> ApplyReleasesImpl: Examining Pin: Windows Explorer.lnk
2018-03-14 13:47:59> ApplyReleasesImpl: Fixing up tray icons
2018-03-14 13:47:59> ApplyReleasesImpl: cleanDeadVersions: for version 0.0.1
2018-03-14 13:47:59> ApplyReleasesImpl: cleanDeadVersions: exclude folder app-0.0.1
4

2 回答 2

4

找出原因;我的应用程序是控制台应用程序。

松鼠并不真正支持这一点。它不会为控制台应用程序创建执行存根,因此快捷方式也被破坏了。似乎这是无证的,你不会真正看到它出现在任何日志中,但在 Github 上有讨论,他们提到这是“故意的”。

于 2018-03-16T07:49:43.717 回答
1

如果防病毒软件删除该软件,也会出现类似的问题。

就我而言,我可以在桌面上看到快捷方式,但它不起作用,并且目标已经消失。BitDefender 误报是原因。将 %LOCALAPPDATA%\MyApp 文件夹列入白名单,等待 BitDefender 客户端更新,然后重新启动,即可解决问题。

于 2020-11-11T06:44:56.293 回答