Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

WPF shortcut has incorrect target

Open kylelaverty opened this issue 3 years ago • 6 comments

Squirrel version(s) v2.0.0

Description When using the .exe generated by Squirrel the resulting desktop shortcut does not use the correct target.

Steps to recreate

  1. Generate a release: "C:\Users\usernamehere\.nuget\packages\squirrel.windows\2.0.0\tools\Squirrel.exe" --releasify HelloWorld.1.0.2.nupkg --releaseDir "C:\SquirrelReleases"
  2. Run the exe generate as part of the release
  3. Try to use the desktop shortcut

Expected behavior Application starts

Actual behavior You get a message titled: Missing Shortcut saying: Windows is searching for HelloWorld.exe. To locate the file yourself, click Browse.

Additional information When I open up the shortcut I see the the following: Target C:\Users\usernamehere\AppData\Local\HelloWorld\HelloWorld.exe Start In C:\Users\usernamehere\AppData\Local\HelloWorld\app-1.0.2

According to the docs it should be in the format: Target: C:\Users\usernamehere\AppData\Local\HelloWorld\Update.exe --processStart HelloWorld.exe Start in: C:\Users\usernamehere\AppData\Local\HelloWorld\app-1.0.2

kylelaverty avatar Aug 26 '20 13:08 kylelaverty

Hello @kylelaverty . When you open the generated nuget package (e.g. HelloWorld-1.0.0-full.nupkg), you should see a HelloWorld_ExecutionStub.exe. This is generated in Releasify. Below is an example: image You are right about the docs, but that has not been my personal experience using the tool.

owns avatar Sep 06 '20 01:09 owns

Hi @owns , I am having the same issue as @kylelaverty, the shortcut has wrong target, looking at your comment, I see that I don't have MyApp_ExecutionStub.exe file, do you know by any chance why my project does not generate this file?

chrno1209 avatar Jan 18 '21 15:01 chrno1209

Hi @owns , I am having the same issue as @kylelaverty, the shortcut has wrong target, looking at your comment, I see that I don't have MyApp_ExecutionStub.exe file, do you know by any chance why my project does not generate this file?

Figured this is worth mentioning - I had previously created this issue for myself when I decided to change my app to a "Console Application" in the project's settings as I wanted a 'hybrid application' - this breaks it. As soon as I change my project back to a forms application (or whatever it says), the issue immediately resolved itself. I hope it's this simple for you too!

Nikp2003 avatar Jan 21 '21 23:01 Nikp2003

I have the same problem. With Winforms, "_ExecutionStub.exe" is generated, but not with WPF application.

vernou avatar Feb 18 '21 16:02 vernou

The WPF application's name was "WpfBySquirrel", but Squirrel skip executable that name contains "squirrel.exe". I renamed the application and now it's work.

Full condition :

rp.CreateReleasePackage(Path.Combine(di.FullName, rp.SuggestedReleaseFileName), packagesDir, contentsPostProcessHook: pkgPath => {
    new DirectoryInfo(pkgPath).GetAllFilesRecursively()
        .Where(x => x.Name.ToLowerInvariant().EndsWith(".exe"))
        .Where(x => !x.Name.ToLowerInvariant().Contains("squirrel.exe"))
        .Where(x => Utility.IsFileTopLevelInPackage(x.FullName, pkgPath))
        .Where(x => Utility.ExecutableUsesWin32Subsystem(x.FullName))
        .ForEachAsync(x => createExecutableStubForExe(x.FullName))
        .Wait();

@kylelaverty, why is the type of your "HelloWorld" application? If it's console, I think Squirrel ignore the exe because ExecutableUsesWin32Subsystem.

vernou avatar Feb 18 '21 17:02 vernou

@vernou output type is set to WinExe but the application was called WpfTestSquirrel. So it sounds like that might have been the issue. I am currently swamped but I will try to find some time this weekend to make an app that does not have the word squirrel in it and see if I can get it to work.

kylelaverty avatar Feb 19 '21 14:02 kylelaverty