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

Any plans to re-integrate to SquirrelWindows? #8

Closed
simader opened this issue Oct 11, 2021 · 30 comments
Closed

Any plans to re-integrate to SquirrelWindows? #8

simader opened this issue Oct 11, 2021 · 30 comments
Labels
question Further information is requested

Comments

@simader
Copy link

simader commented Oct 11, 2021

Hi,

Do you have any plans to push your changes back to the main squirrel repo?

Best,
Andreas

@caesay
Copy link
Member

caesay commented Oct 15, 2021

I offered but was declined by the maintainers of that repo. I don't think they want to update the toolchain to dotnet 5+ and prefer to stay on the full framework. I prefer to continue updating to more modern toolchains (net5, net6, etc) so we can continue to get improvements and even ship zero-dependency apps!

@caesay caesay pinned this issue Oct 15, 2021
@simader
Copy link
Author

simader commented Nov 25, 2021

I have seen you made additional changes to this repo since your last nuget-prerelease. Are you planning to release this soon?

Addtionally, do you have any plans to strong name the assemblies?

@caesay
Copy link
Member

caesay commented Nov 25, 2021

@simader Indeed, there have been many improvements that are unreleased. I was waiting for net6 to be officially released, so the next version could ship a fully self-contained Update.exe. the net6 apphost comes with many single-file improvements, including compression support, to keep the file size down. I will plan to release as soon as I have time to do a little bit more testing.

@simader
Copy link
Author

simader commented Nov 29, 2021

Thanks for your efford and answer. We really appreciate your work. I hope you find time soon.
We just upgraded our WPF Clients to .net6 and I am just a little bit stuck, because of Squirrel.

@caesay
Copy link
Member

caesay commented Dec 4, 2021

I should post a new version soon - can you elaborate on why you need a strong name? this is not validated any longer in dotnet core / dotnet 5.

@simader
Copy link
Author

simader commented Dec 6, 2021

Hi caesay,
I have a strongnamed WPF application, which requires all references also be strongnamed (also in .net6). However i could do this on my side as well.

Befor releasing a new version: could you update the Runtime-Download-Link in the RuntimeInfo.cpp?

{
_WIN32_WINNT_WIN7, 1,
L"net6", L".NET 6.0.0-rc.2",
L"https://download.visualstudio.microsoft.com/download/pr/ae678751-3c1a-4f8b-a37b-e2e327af191e/3383ed7040b9f0184ff36c93ab129659/windowsdesktop-runtime-6.0.0-rc.2.21501.6-win-x64.exe",
0, L"WindowsDesktop.App 6.0"
}

I am happy if i could help testing. however with the current version i always get the popup "To run this application, you must install .NET Desktop Runtime 6.0.0 (x64)."

@caesay
Copy link
Member

caesay commented Dec 6, 2021

Strong name signing is added in eb0de7e. Would love your help with testing, and I will let you know as soon as I publish the next prerelease, I am just testing now. There have been lots of changes, including many improvements/breaking changes to the squirrel command line tool for creating packages. I have kept the command line for Update.exe the same, to maintain backwards compatibility with already-deployed applications.

@caesay
Copy link
Member

caesay commented Dec 6, 2021

This has now been released on github and nuget. I have tested and released already with my own app. Let me know if you have any questions, happy to help.

@simader
Copy link
Author

simader commented Dec 6, 2021

Hi caesay. I tried to get to run a very simple .net6 WPF sample application. However everytime I still get :To run this application, you must install .NET Desktop Runtime 6.0.0 (x64).

WpfApp1.zip

Any ideas. to run this sample just run the powershell squirrel.ps1

@caesay
Copy link
Member

caesay commented Dec 6, 2021

@simader The sample app you uploaded works for me - does the issue happen when you run Squirrel.exe, or when you try to execute your sample app WpfApp1.exe? You need to have the .net6 desktop runtime installed before you will be able to run WpfApp1 unless you publish it as self contained.

Can you share the output when you run the command dotnet --info in cmd?

Squirrel itself (both Squirrel.exe and Update.exe) are self contained, meaning they have zero dependencies and should not require dotnet 6 runtime installed to use.

Your sample app WpfApp1 still requires the net6 runtime in one way or another, here are two options:

  • You could ship your app as self contained too, by using dotnet publish --self-contained=true -r win-x64 -c Release for example. This creates an pretty large update package (100mb+?) because you are sending the whole .net 6 runtime with your app. (but delta updates will remain small, because the framework dll's will not change)
  • Or, You could ask Squirrel to automatically install the net6 runtime for you during setup, using the --framework argument. For example:
    Squirrel releasify --package $packageName --releaseDir "SqurirrelRelease" --framework net6.
    Then run Setup.exe to install your app and the runtime.

@simader
Copy link
Author

simader commented Dec 6, 2021

Sorry, to bother you. I tried both options and don't get it to run.

.NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.100\

Host (useful for support):
Version: 6.0.0
Commit: 4822e3c3aa

.NET SDKs installed:
3.1.415 [C:\Program Files\dotnet\sdk]
5.0.203 [C:\Program Files\dotnet\sdk]
6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

@caesay
Copy link
Member

caesay commented Dec 6, 2021

@simader can you clarify what exactly is failing? is Squirrel.exe itself failing to run with this error or is the WpfApp1.exe that is failing to run?

@simader
Copy link
Author

simader commented Dec 6, 2021

The resulting Setup.Exe opens the following message box: However even when i click install, it comes the popup a second time, and after that the Application won't start.


WpfApp1.exe

To run this application, you must install .NET Desktop Runtime 6.0.0 (x64).

Would you like to download it now?

Yes No

With self-contained a am now able to run Setup.exe and install it. However I would prefer "not self-contained"

@caesay
Copy link
Member

caesay commented Dec 6, 2021

@simader I have reproduced this and have found the issue. it's in your nuspec. So you need to add the --framework net6 argument, so Squirrel will install net6. I have tested with the sample app and this part is working fine. Next, WpfApp1.exe fails to launch, because it's missing the WpfApp1.runtimeconfig.json file in the app directory - this is not an optional file, it must be copied. You can fix this issue by adding the following line to WpfApp1.nuspec

<file src="WpfApp1\bin\Debug\net6.0-windows\publish\*.json" target="lib\net45" />

@simader
Copy link
Author

simader commented Dec 6, 2021

Thanks very much, you are my hero

@caesay
Copy link
Member

caesay commented Dec 6, 2021

Might I also suggest you check out the new pack command? You can avoid errors like this, and eliminate the need for calling Nuget entirely -

Your whole build script could be just this:

$pathToSquirrel = $env:USERPROFILE + "\.nuget\packages\clowd.squirrel\2.6.2-pre\tools\Squirrel.exe";
Set-Alias Squirrel $pathToSquirrel

dotnet publish
Squirrel pack -f net6 --packName WpfApp1 --packVersion 1.0.0 --packAuthors "WpfApp1 GmbH" --packDirectory "WpfApp1\bin\Debug\net6.0-windows\publish"

No need to create a nuspec

@simader
Copy link
Author

simader commented Dec 7, 2021

Hi caesay,
I also successfully implemented it now in our big WPF client. Working like a charm.
Now one question: why did the size of Squirrel.exe and update.exe increase that much?

@caesay
Copy link
Member

caesay commented Dec 7, 2021

This is detailed here. Squirrel no longer has any dependencies (the dotnet framework does not need to be installed). I have worked very hard to get it as small as possible - unfortunately Update.exe can not get much smaller than 12mb unless there are future improvements to dotnet.

@caesay caesay added the question Further information is requested label Dec 9, 2021
@simader
Copy link
Author

simader commented Dec 13, 2021

Hi, I just tried your newest prerelease.

However it now failes because

[ERRO] System.IO.DirectoryNotFoundException: Could not find a part of the path '%localappdata%\SquirrelTemp\tempd\lib.NETFramework\Squirrel.exe'.
at System.IO.FileSystem.CopyFile(String , String , Boolean )
at System.IO.File.Copy(String , String , Boolean )
at SquirrelCli.Program.<>c__DisplayClass4_0.b__7(String pkgPath, String frameworkName)
at Squirrel.ReleasePackage.CreateReleasePackage(String outputFile, Func2 releaseNotesProcessor, Action2 contentsPostProcessHook)
at SquirrelCli.Program.Releasify(ReleasifyOptions options)
at SquirrelCli.CommandAction1.Execute(IEnumerable1 args)
at SquirrelCli.CommandSet.Execute(String[] args)
at SquirrelCli.Program.Main(String[] args)

Here again is my sample:
WpfApp1.zip

I also tried to clear this folder totally.

@caesay
Copy link
Member

caesay commented Dec 13, 2021

I believe this is fixed this in 4f31bf8 which is part of version 2.6.28, can you let me know?

@simader
Copy link
Author

simader commented Dec 13, 2021

Thanks for the quick reply.
Yes, the first error was fixed.
However, when I now add a new version number This failes:
[ERRO] Program: Failed to update Setup.exe with new Zip file: System.AggregateException: One or more errors occurred. (Failed to write Zip to Setup.exe!

Setup: C:\Dev\SamplesGit\Squirrel\WpfApp1\SqurirrelRelease\Setup.exe, Zip: C:\Users.\AppData\Local\Temp\tmpC46E.tmp
Starting to read file!
Updating Resource!
Finished!
Failed to update resource
Usage: WriteZipToSetup [Setup.exe template] [Zip File])
---> System.Exception: Failed to write Zip to Setup.exe!

Setup: C:\Dev\SamplesGit\Squirrel\WpfApp1\SqurirrelRelease\Setup.exe, Zip: C:\Users.\AppData\Local\Temp\tmpC46E.tmp
Starting to read file!
Updating Resource!
Finished!
Failed to update resource
Usage: WriteZipToSetup [Setup.exe template] [Zip File]
at Squirrel.HelperExe.BundleZipIntoTargetSetupExe(String targetSetupExe, String zipPath, String frameworkVersion, String backgroundGif)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean )
at System.Threading.Tasks.Task.Wait(Int32 , CancellationToken )
at SquirrelCli.Program.Releasify(ReleasifyOptions options)

@simader
Copy link
Author

simader commented Dec 13, 2021

Also Re-Running (reinstall) Setup.exe doesn't work. I have to delete the whole folder manually

[13.12.21 11:19:16] warn: Program: Install path C:\Users.\AppData\Local\WpfApp1 already exists, burning it to the ground
[13.12.21 11:19:17] error: Program: Failed to remove existing directory on full install, is the app still running???: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users.\AppData\Local\WpfApp1\latestver'.
at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String , Boolean ) at System.IO.Enumeration.FileSystemEnumerator1.Init()
at System.IO.Enumeration.FileSystemEnumerator1..ctor(String , Boolean , EnumerationOptions ) at System.IO.Enumeration.FileSystemEnumerable1.DelegateEnumerator..ctor(FileSystemEnumerable1 , Boolean ) at System.IO.Enumeration.FileSystemEnumerable1..ctor(String , FindTransform , EnumerationOptions , Boolean )
at System.IO.Enumeration.FileSystemEnumerable1..ctor(String , FindTransform , EnumerationOptions ) at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String , String , EnumerationOptions ) at System.IO.Directory.InternalEnumeratePaths(String , String , SearchTarget , EnumerationOptions ) at System.IO.Directory.GetFiles(String , String , EnumerationOptions ) at System.IO.Directory.GetFiles(String ) at Squirrel.Utility.DeleteDirectory(String directoryPath) at Squirrel.Utility.<>c.<<DeleteDirectory>b__22_1>d.MoveNext() --- End of stack trace from previous location --- at Squirrel.Utility.<>c__DisplayClass16_11.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Squirrel.Utility.DeleteDirectory(String directoryPath)
at Squirrel.Utility.LogIfThrows(IFullLogger This, LogLevel level, String message, Func1 block) [13.12.21 11:19:17] fatal: Finished with unhandled exception: System.AggregateException: One or more errors occurred. (Could not find a part of the path 'C:\Users\.\AppData\Local\WpfApp1\latestver'.) ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\.\AppData\Local\WpfApp1\latestver'. at System.IO.Enumeration.FileSystemEnumerator1.CreateDirectoryHandle(String , Boolean )
at System.IO.Enumeration.FileSystemEnumerator1.Init() at System.IO.Enumeration.FileSystemEnumerator1..ctor(String , Boolean , EnumerationOptions )
at System.IO.Enumeration.FileSystemEnumerable1.DelegateEnumerator..ctor(FileSystemEnumerable1 , Boolean )
at System.IO.Enumeration.FileSystemEnumerable1..ctor(String , FindTransform , EnumerationOptions , Boolean ) at System.IO.Enumeration.FileSystemEnumerable1..ctor(String , FindTransform , EnumerationOptions )
at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String , String , EnumerationOptions )
at System.IO.Directory.InternalEnumeratePaths(String , String , SearchTarget , EnumerationOptions )
at System.IO.Directory.GetFiles(String , String , EnumerationOptions )
at System.IO.Directory.GetFiles(String )
at Squirrel.Utility.DeleteDirectory(String directoryPath)
at Squirrel.Utility.<>c.<b__22_1>d.MoveNext()
--- End of stack trace from previous location ---
at Squirrel.Utility.<>c__DisplayClass16_11.<<ForEachAsync>b__1>d.MoveNext() --- End of stack trace from previous location --- at Squirrel.Utility.DeleteDirectory(String directoryPath) at Squirrel.Utility.LogIfThrows(IFullLogger This, LogLevel level, String message, Func1 block)
at Squirrel.Update.Program.Install(Boolean silentInstall, ProgressSource progressSource, String sourceDirectory)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean )
at System.Threading.Tasks.Task.Wait(Int32 , CancellationToken )
at System.Threading.Tasks.Task.Wait()
at Squirrel.Update.Program.executeCommandLine(String[] args)
at Squirrel.Update.Program.main(String[] args)

@caesay
Copy link
Member

caesay commented Dec 13, 2021

However, when I now add a new version number This failes:
[ERRO] Program: Failed to update Setup.exe with new Zip file: System.AggregateException: One or more errors occurred. (Failed to write Zip to Setup.exe!

I can't reproduce this unfortunately. Using your latest sample app and version 2.6.28 I was able to produce a release for version 1.0.3 and then produce another release for version 1.0.4 without an issue. Can you provide any additional information?

Also Re-Running (reinstall) Setup.exe doesn't work. I have to delete the whole folder manually

I can see an issue here, I will fix this

@simader
Copy link
Author

simader commented Dec 13, 2021

Okay, somehow the first issue I also could not reproduce any more. Sorry.

However after the update the Folder looks like this: and the displayed VersionNumber is 1.0.0 again. Seems to be startet from the "latestver" directory. Which is new after the update.

grafik

@caesay
Copy link
Member

caesay commented Dec 13, 2021

The behaviour you see with the version 1.0.0 displayed is because of the code in the sample app, and because of a change in Squirrel. The current release of Squirrel creates the latestver junction you see there, and runs your app from that folder. So the path to your exe becomes "%localappdata\WpfApp1\latestver\WpfApp1.exe". The code in your sample app looks for the "app-{ver}" folder in it's path, and can't find it, so it shows the AssemblyVersion (which is 1.0.0.0).

The next version of Squirrel will not have this latestver junction, it will return to the original behavior of running your app inside the "app-1.0.7" folder.

@caesay
Copy link
Member

caesay commented Dec 13, 2021

I have published a new update (2.6.34) which removes the "latestver" functionality and returns it to the old-squirrel behavior.

@simader
Copy link
Author

simader commented Dec 16, 2021

Seems to be fine, everything again with 2.6.34. Thanks for your efford.

@simader simader closed this as completed Dec 16, 2021
@simader
Copy link
Author

simader commented Dec 16, 2021

One small difference i found in the resulting Setup.exe. Previewsly the in the Windows explorer was shown the Icon. Now, this icon is gone again. Was this on purpose?
grafik

@simader simader reopened this Dec 16, 2021
@caesay
Copy link
Member

caesay commented Dec 16, 2021

Please review the command line options carefully to set the icon. Also, beware of your windows icon cache (try renaming the file, and see if the icon updates.)

@caesay
Copy link
Member

caesay commented Dec 20, 2021

I believe this is no longer an issue, please open a new issue if you run into further problems

@caesay caesay closed this as completed Dec 20, 2021
@caesay caesay unpinned this issue Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants