clowd / Clowd.Squirrel

Quick and easy installer and automatic updates for cross-platform dotnet applications
426 stars 39 forks source link

Exception: There are no SquirreAwareApp's in the provided package #81

Closed WuYin-Lyu closed 2 years ago

WuYin-Lyu commented 2 years ago

When using Releasify to pack my project. I get an exception: There are no SquirreAwareApp's in the provided package. Squirrel is looking into "lib\" folder for the SquirrelAwareValue. In most framework dependent app, the SquirrelAwareValue will be in "lib\%framework%\" folder. Is it better to search SquirrelAwareValue in "lib\%framework%\" folder.

caesay commented 2 years ago

You can place your app files into any lib directory. lib/blah is valid, and so is lib/framework.

The reason you are getting this message is because you have not marked any executables as SquirrelAware by following the readme and adding the required entry to your application manifest.

Please review the Readme, confirm you have completed the steps and re-open an issue if you are still having problems.

WuYin-Lyu commented 2 years ago

thanks. "dotnet publish" did not include manifest file, which cause the problem

ypicard commented 2 years ago

How did you fix this @WuYin-Lyu ?

ypicard commented 2 years ago

I do not understand how you specify the SquirrelAwareVersion .

I have added [assembly: AssemblyMetadata("SquirrelAwareVersion", "1")] to my AssemblyInfo.cs but this does not work, and i still get:

[ERRO] System.ArgumentException: There are no SquirreAwareApp's in the provided package.
Please mark an exe as aware using the assembly manifest, or use the '--allowUnaware' argument 
to skip this validation and create a package anyway (not recommended).
caesay commented 2 years ago

Hi, @ypicard, please review the main readme.md. This fork does not support the AssemblyMetadata attribute, you must mark your binary as Squirrel aware by following the quick-start guide and adding to your assembly manifest.

ypicard commented 2 years ago

All right, I have not found where it is specifically said that AssemblyMetadata is not supported, sorry. I am quite new to the Windows / c# / dotnet world and did not know about the difference.

In the readme, the following is stated:

Add SquirrelAwareVersion to your assembly manifest to indicate that your exe supports Squirrel.

<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<SquirrelAwareVersion xmlns="urn:schema-squirrel-com:asm.v1">1</SquirrelAwareVersion>
</assembly>

I am currently working on a c# project. Would you be able to tell me where I am supposed to add this specifically? in the .csproj file? With what syntax? It seems to require ItemGroup, Property or some other nesting to be valid.

Thank you very much for the help.

caesay commented 2 years ago

If you are using Visual Studio

  1. Right click your project in the solution explorer and add a new item image
  2. Choose to add a new Application Manifest File image
  3. Replace the contents of that file with the text from the readme
    <?xml version="1.0" encoding="utf-8"?>
    <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
     <SquirrelAwareVersion xmlns="urn:schema-squirrel-com:asm.v1">1</SquirrelAwareVersion>
    </assembly>

If you are not using Visual Studio

  1. Create a new file called app.manifest in the same directory as your .csproj file.
  2. Set the contents of the file to the xml shown above
  3. Add the following lines to your csproj:

    <PropertyGroup>
     <ApplicationManifest>app.manifest</ApplicationManifest>
    </PropertyGroup>
ypicard commented 2 years ago

This is exactly what I was looking for... Thank you so much for the detailed answer.

knd775 commented 2 years ago

My problem is that when using a single file self-contained executable, this doesn't work. The executable itself doesn't use my manifest, but the embedded dll does. Any workarounds or other options?

caesay commented 2 years ago

I can confirm that the manifest is included in the final exe in every variation of published dotnet app. Including self contained and publishsinglefile. If the manifest is not present, please check and share your build instructions and csproj contents.

caesay commented 2 years ago

Alternatively, for those who do not wish to use an assembly manifest, you can create a file called YourFile.exe.squirrel in your build output directory and set the contents of the file to 1.

rzamponiAtIgt commented 2 years ago

Is there a specific reason why you removed the possibility to simply set the AssemblyMetadataAttribute? In our company we used a custom SDK to create AssemblyMetadataAttributes with the required squirrel.windows properties SquirrelAwareVersion, SquirrelAppName and SquirrelInstallerOutputPath during build. While the usage of the file is a valid workaround it feels a bit clumsy in comparison to the attribute.

caesay commented 2 years ago

Yes, there are a few reasons. Searching for the attribute requires a dependency on Mono.Cecil which is not a light weight dependency and has been known to have bugs and cause issues in Squirrel.Windows.

It requires us to find and load the .net assembly with Mono.Cecil, which is not possible if the application is .net core because the entry assembly is a native exe and not a .net dll. There is a work-around for self-contained but non-bundled apps where we can try and find the entry dll by replacing .exe with .dll and hoping it exists, but this work-around does not work for apps created with PublishSingleFIle.

Also, this attribute is not viable for native apps using Squirrel, meaning we need to provide several different approaches for marking a binary as SquirrelAware for .net and for native applications, whereas the sidecar file (your.exe.squirre) and the application manifest (<SquirrelAwareVersion>1</SquirrelAwareVersion>) work uniformly for all the aforementioned cases.