This project is no longer under active development
The successor for SDk projects is KsWare.BuildTools.IncrementVersion
Executes commands on build.
With this package it is easy to build and create/publish the nuget package with auto increment version support.
You can configure your Debug build to create a pre-release package with an auto incremented "-CI#####" suffix and your Release build with an auto incremented patch number.
- For test purposes only. No warranty.
- Call NuGet commands
- Different build configurations
- Hierarchical configuration (define nuget APIKey outside of project)
- NuGet: auto increment patch version
- NuGet: auto increment CI version [e.g. 1.0.0-CI00001]
- NuGet: supports install.ps1/uninstall.ps1 (also in VS 2017)
- Public.
- Uses Semantic Versioning 2.0.0
- call other commands
- delayed signing (define key.snk outside of project)
- Add the KsWare.MSBuildTargets nuget package
- optional edit your
project.nuspec
- create/edit
KsWare.MSBuildTargets.config
- build your project
set ProjectPath=C:\dev\YourProject\YourProject.csproj
set TargetPath=C:\dev\YourProject\bin\release\YourProject.dll
KsWare.MSBuildTargets.exe -pp "%ProjectPath%" -cn Release -pn "Any CPU" -tp "%TargetPath%"
The PackageBuilder.config contains the commands and properties.
<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" FileVersion="1.0">
<BuildConfiguration>
<Property Name="NuGet.Pack.OutputDirectory" Value="D:\Develop\Packages" />
<Property Name="NuGet.Push.ApiKey" Value="your-nuget-api-key-" />
<Property Name="SN.KeyFile" Value="D:\Develop\Company.snk" />
</BuildConfiguration>
<BuildConfiguration Configuration="Debug">
<Command>nuget pack $IDE.ProjectPath$ -OutputDirectory $OutputDirectory$ -version $IncrementCI$</Command>
</BuildConfiguration>
<BuildConfiguration Configuration="Release">
<Command>sn -R $IDE.ProjectPath$ $SN.KeyFile$</Command>
<Command>nuget pack $IDE.ProjectPath$ -OutputDirectory $OutputDirectory$ -version $IncrementPatch$</Command>
<Command>nuget push $PackagePath$ -apikey $ApiKey$</Command>
</BuildConfiguration>
</Configuration>
The configuration is hierarchical. That means you can define a config file with more common (or secret) properties (and commands) in a directory with higher level and project specific settings at project level.
\Develop\
KsWare.MSBuildTargets.config (Master with ApiKey)
\Project\
KsWare.MSBuildTargets.config (Project specific)
Hierarchical property reading:
- in the matching configuration
- in the empty configuration
- in parent configuration file in the matching configuration
- in parent configuration file in the empty configuration
- continue with step 3 until a property has been found
Hierarchical command reading:
As in property reading but commands read as complete block. That means, if a configuration contains commands, only this commands are used.
Note: Not yet implemented
Parameter are usually read from KsWare.MSBuildTargets.config and can also be overwritten by command line:
-version Increment
will increment patch version-version IncrementCI
will increment CI version [e.g. 1.0.0-CI00001]- and all known NuGet.exe parameter
- support YAML/JSON configuration
- DONE include a sample KsWare.MSBuildTargets.config
- DONE include a template nuspec
- DONE avoid use of Build Events
- DONE avoid use of %PATH%, instead use tool directory
Licensed under the MIT licence.
Thanks to Lars Skovslund and his Project NuGet.Package.Builder to get me an example how to use .targets and .nuspec.