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

Squirrel won't release #1084

Closed
ghost opened this issue Jun 30, 2017 · 7 comments
Closed

Squirrel won't release #1084

ghost opened this issue Jun 30, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Jun 30, 2017

Well, I'm entirely unsure what I am doing wrong here.
My eyes have been locked onto the documentation all this morning on the wiki and can't seem to get squirrel to comply, or i'm overlooking some minor detail.

Here's the steps I'm doing:

  1. I started out by following the documentation and making my project a nuget file, by downloading nuget.exe and executed nuget.exe spec and edited the Package.nuspec that was created to reflect my application:
<?xml version="1.0"?>
<package >
  <metadata>
    <id>Pitter</id>
    <version>1.0.0.0</version>
    <authors>Andrew Huaghie</authors>
    <owners>Pitter LLC</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Pitter Desktop Client</description>
    <releaseNotes>Main Package</releaseNotes>
    <copyright>Copyright 2017</copyright>
    <tags>None</tags>
    <dependencies>
    <!-- no dependencies for this project -->
    </dependencies>
    <files>
      <file src="*.*" target="lib\net45\" exclude="*.pdb;*.nupkg;*.vshost.*"/>
      <file src="**\*.*" target="lib\net45\" exclude="*.pdb;*.nupkg;*.vshost.*"/>
    </files>
  </metadata>
</package>
  1. I then proceed to create the lib/net45 folder in the solution, rather than the project folder as I assumed that's where it should be, as it is unspecified in the wiki.
  2. Following the rest of the steps, I copied the files from the release directory to the net45 folder, ran squirrel.exe --releasify .\Package.nuspec and it created a Releases folder that is only containing my nuspec and a RELEASES file.

Could someone confirm if this is an issue, or if I'm doing something wrong?
Thanks.

@lukeskinner
Copy link
Contributor

lukeskinner commented Jun 30, 2017

squirrel.exe --releasify .\Package.nuspec

Squirrel expects to take in the nuget package (.nupkg) instead of the .nuspec file.

The nuspec file is the definition of your nuget package (.nupkg).
The nupkg file is a zip containing your application - the structure of this zip is defined by your nuspec file.

The lib\net45 folder that you mentioned needs to exist in your nupkg zip - you don't manually create this.

Have a look at https://github.com/Squirrel/Squirrel.Windows/blob/master/docs/using/visual-studio-packaging.md.

You will need to add the Build Target at the top - replace the MyApp references to the name of your project/assembly.

Update your .nuspec file to include this files section. A full nuspec example is in the link above. The target here of lib\net45 means it will take the files you build and then put them into a lib\net45 folder inside your nuget package.

 <files>
    <file src="*.*" target="lib\net45\" exclude="*.pdb;*.nupkg;*.vshost.*"/>
  </files>

When you build your project in the release configuration, in the bin\release folder you should see a .nupkg file named after your project/assembly.

Once you have this you can finally call squirrel using:

squirrel.exe --releasify .\Package.nupkg

@ghost
Copy link
Author

ghost commented Jun 30, 2017

Hey! Thanks for the reply. I appreciate the help and will be sure to close this issue as soon as I get it going.

@ghost
Copy link
Author

ghost commented Jun 30, 2017

Okay, I had to tweak the target a bit to reference the binaries, but now I'm encountering an issue of which I believe to be related to the output filename

<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'">
  <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
    <Output TaskParameter="Assemblies" ItemName="myAssemblyInfo"/>
  </GetAssemblyIdentity>
  <Exec Command=".\nuget.exe pack .\Pitter.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(OutDir) -BasePath $(OutDir)" />
  <Exec Command="..\packages\squirrel.windows.1.7.6\tools\Squirrel.exe $(OutDir)Pitter.%(myAssemblyInfo.Version).nupkg" />
</Target>

I do see the nupkg coming out as Pitter.1.0.0.nupkg with the section %(myAssemblyInfo.Version).
Please correct me if I am wrong, but shouldn't that come out with an extra zero if the assembly version is "1.0.0.0"?
It appears the second Exec is looking for it in that format which now throws the following error:

Severity	Code	Description	Project	File	Line	Suppression State
Error		The command "..\packages\squirrel.windows.1.7.6\tools\Squirrel.exe bin\Release\Pitter.1.0.0.0.nupkg" exited with code -1.	Pitter	C:\Users\elyci\Documents\Visual Studio 2017\Projects\Windows-Desktop-Client\Pitter\Pitter.vbproj	196	

@lukeskinner
Copy link
Contributor

Squirrel enforces SemVer for version numbers. Put simply this means you are allowed to create versions like:
1.0.0
1.0.0-beta2

But not:
1.0.0.0

In your case I would open the AssemblyInfo.cs in your project and update the AssemblyVersion & AssemblyFileVersion attributes to follow this versioning strategy. ie if you have

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

change it to

[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]

@ghost
Copy link
Author

ghost commented Jun 30, 2017

Afraid even with those changes, it still looks for 1.0.0.0.

@lukeskinner
Copy link
Contributor

That page I sent appears to be out of date slightly. I found the fix in #630.

  <Exec Command="..\packages\squirrel.windows.1.7.6\tools\Squirrel.exe $(OutDir)Pitter.$([System.Version]::Parse(%(myAssemblyInfo.Version)).ToString(3)).nupkg" />

@ghost
Copy link
Author

ghost commented Jun 30, 2017

We're rolling! thank you so much!

@ghost ghost closed this as completed Jun 30, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant