Created
February 23, 2018 09:35
-
-
Save roh85/521d6eb659afa684cca73d9fb6190198 to your computer and use it in GitHub Desktop.
Squirrel msbuild target
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Release'"> | |
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> | |
<Output TaskParameter="Assemblies" ItemName="myAssemblyInfo" /> | |
</GetAssemblyIdentity> | |
<ItemGroup> | |
<!-- If your .NET version is <3.5 and you get build error, move this ItemGroup outside of Target --> | |
<NuGetExe Include="..\packages\NuGet.CommandLine.*\tools\nuget.exe" /> | |
<SquirrelExe Include="..\packages\Squirrel.Windows.*\tools\squirrel.exe" /> | |
</ItemGroup> | |
<PropertyGroup> | |
<ReleaseDir>..\Releases\</ReleaseDir> | |
<!-- Extra optional params for squirrel. can be empty --> | |
<SquirrelParams>--no-msi</SquirrelParams> | |
<SemVerNumber>$([System.Version]::Parse(%(myAssemblyInfo.Version)).ToString(3))</SemVerNumber> | |
</PropertyGroup> | |
<!-- Add some nice errors for the next person that comes along --> | |
<Error Condition="!Exists(%(NuGetExe.FullPath))" Text="You are trying to use the NuGet.CommandLine package, but it is not installed. Please install NuGet.CommandLine from the Package Manager." /> | |
<Error Condition="!Exists(%(SquirrelExe.FullPath))" Text="You are trying to use the Squirrel.Windows package, but it is not installed. Please install Squirrel.Windows from the Package Manager." /> | |
<!-- Build nupkg into the project local bin\Release\ directory temporarily --> | |
<Exec Command='"%(NuGetExe.FullPath)" pack $(TargetName).nuspec -Version $(SemVerNumber) -OutputDirectory $(OutDir) -BasePath $(OutDir)' /> | |
<!-- Squirrelify into the release dir (usually at solution level. Change the property above for a different location --> | |
<Exec Command='"%(SquirrelExe.FullPath)" --releasify $(OutDir)MyApp.$(SemVerNumber).nupkg --releaseDir=$(ReleaseDir) $(SquirrelParams)' /> | |
</Target> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment