Closed RichardD2 closed 12 months ago
Some progress: I changed the output path in the .nupkg
file from lib\net472\
to lib\
, and now I get a different error:
[ERRO] System.InvalidOperationException: The input package file ... must have no dependencies. at Squirrel.ReleasePackage.CreateReleasePackage(...) in ./Internal/ReleasePackage.cs:line 92
Surely that doesn't mean we can't distribute applications with any dependencies, as the error message suggests.
I must be missing something here.
I've removed the target framework group:
<dependencies>
<group targetFramework="..." />
</dependencies>
NuGet Package Explorer now shows "no dependencies":
It contains a single lib
folder:
And now I get:
[ERRO] System.InvalidOperationException: Invalid package: One 'lib' folder expected. None was found.
See readme.md you can use the Squirrel pack --packId...
command then you don't need a .nuspec
file
@remco1271 Thanks; that pointed me in the right direction.
I was trying to minimize the changes, so replacing nuget pack
+ releasify
with just pack
was a step too far.
Looking at the .nuspec
file generated by the pack
command, it seems the files need to be in a lib\native
folder within the package, rather than lib\net472
or just lib
.
With that in place, I've finally managed to build a new release. 😁 Now I just need to check that the old Squirrel.Windows app can update from this new release.
For ref, my final files were:
Project.nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Package-Id</id>
<version>0.0.0.0</version>
<authors>Company Name</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<icon>Icon.png</icon>
<projectUrl>website</projectUrl>
<description>description</description>
<copyright>Copyright © Company Name</copyright>
<language>en-GB</language>
</metadata>
<files>
<file src="*.*" target="lib\native\" exclude="*.nupkg;*.vshost.*;*.xml;*.dll.config"/>
<file src="..\..\..\..\..\Icon.png" target="Icon.png" />
</files>
</package>
Project.csproj:
<Target Name="SquirrelReleasify" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" />
</GetAssemblyIdentity>
<PropertyGroup>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(USERPROFILE)\.nuget\packages\</NuGetPackageRoot>
</PropertyGroup>
<ItemGroup>
<SquirrelExe Include="$(NuGetPackageRoot)\Clowd.Squirrel\2.9.42\tools\squirrel.exe" />
<AzureSignToolExe Include="$(USERPROFILE)\.dotnet\tools\azuresigntool.exe" />
</ItemGroup>
<Error Condition="!Exists(%(SquirrelExe.FullPath))" Text="You are trying to use the Clowd.Squirrel package, but it is not installed. Please install Clowd.Squirrel from the Package Manager. [%(SquirrelExe.FullPath)]" />
<Error Condition="!Exists(%(AzureSignToolExe.FullPath))" Text="You are trying to use the AzureSignTool, but it is not installed. Please run "dotnet tool install --global azuresigntool" to install it. [%(AzureSignToolExe.FullPath)]" />
<PropertyGroup>
<ReleaseDir>$(ProjectDir)Releases</ReleaseDir>
<SquirrelParams>--framework=net472 --signTemplate "%(AzureSignToolExe.FullPath) sign -s -kvu https://my-kv.vault.azure.net/ -kvc MyCert -kvm -fd sha384 -tr http://timestamp.digicert.com -td sha384 {{file}}"</SquirrelParams>
<SemVerNumber>$([System.Version]::Parse(%(myAssemblyInfo.Version)).ToString(3))</SemVerNumber>
<SourcePackage>$(ProjectDir)bin\$(Configuration)\Package-Id.$(SemVerNumber).nupkg</SourcePackage>
</PropertyGroup>
<Exec Command="nuget pack Package-Id.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=$(Configuration) -OutputDirectory $(ProjectDir)bin\$(Configuration)\ -BasePath $(OutDir)" />
<Error Condition="!Exists($(SourcePackage))" Text="The source package $(SourcePackage) does not exist." />
<Exec Command=""%(SquirrelExe.FullPath)" releasify --package="$(SourcePackage)" --releaseDir="$(ReleaseDir)" $(SquirrelParams)" />
</Target>
The update works! 🥳🎉
I am migrating from Squirrel.Windows to support signing with the
AzureSignTool
. My application targets .NET Framework 4.7.2, and I am referencing Clowd.Squirrel v2.9.42, which is the latest non-preview version on NuGet.No matter what I do,
releasify
returns an error.Skipping the
--framework
argument, or passing--framework=net472
returns:Passing
--framework=.NETFramework4.7.2
returns:My
.nuspec
file originally had:I have tried changing it to:
which made no difference. NuGet Package Explorer still shows that the
.nupkg
file has a single target framework:Have I missed something obvious, or does this project not actually support .NET Framework applications?