Squirrel / Squirrel.Windows

An installation and update framework for Windows desktop apps
MIT License
7.23k stars 1.02k forks source link

squirrel --releasify throws 'File is not a PE image' exception #1832

Closed teamboyd closed 1 year ago

teamboyd commented 1 year ago

Squirrel version(s) 2.0.1

Description squirrel --releasify throws 'File is not a PE image' exception

Steps to recreate

  1. I have a myapp.nuspec file I created via the documentation in Visual Studio Packaging
  2. I execute nuget pack to create the .nupkg file (nuget pack myapp.nuspec -Version 1.0.0.0 -Properties Configuration=Release -OutputDirectory bin\Release\ -BasePath bin\Release\
  3. I then execute the squirrel --releasify myapp.1.0.0.nupkg and this throws the exception.

Expected behavior I expect squirrel to build my release files.

Actual behavior When executing the 'squirrel --releasify myapp.1.0.0.nupkg' it throws the 'File is not a PE image' exception.

Additional information Here's the call stack...

teamboyd commented 1 year ago

@jjeffery do you possibly have more details on your solution to issue #1034

teamboyd commented 1 year ago

I found what the issue is. In my .nuspec file, the node's text had a dash in it. The documentation states no spaces or dots should be used but it states nothing about dashes. For example, this causes releasify to fail My-App and throws the "File is not a PE image" exception. This happens because the logic falls through and makes it's way to that point in the source code. The code should look for invalid characters in the Package ID and throw an exception (stating exactly the issue with the Package ID) before it falls through to the "File is not a PE image" exception.

caesay commented 1 year ago

Dashes and dots can be used in the package ID in my fork of this project, and any invalid / unsupported package id's will be validated and rejected if they are incorrect. It's one of many bugs which have been fixed there.

Also, in the fork, it is not required to create a nupkg yourself. You can just use the new pack command and give it a folder of files (eg. the output of your build) and it will create all the necessary packages for you.