Sample build system for a dotnetcore library using cake and gitversion
> build.bat
This will execute the following tasks
Clean
- Cleans the artifact directory and bin / obj folderRestore
- Runs dotnet restore- *
UpdateAssemblyVersionInformation
- uses GitVersion to update theAssemblyFileVersion
,AssemblyFileVersion
andAssemblyInformationalVersion
attributes inGlobalAssemblyInfo.cs
Build
- Runs dotnet buildTest
- Runs dotnet test- *
UpdateProjectJsonVersion
- Updates the version setting in theproject.json
of the project being packed with version information from GitVersion Pack
- Runs dotnet pack and outputs the theartifacts
directory
*These steps modify files so are only executed when running in a CI environment (as detected by Cake). This allows you to execute the build locally without modifiying git tracked files.
Every commit will produce an auto incrementing CI package (ie. DotNetCoreBuild.0.1.0-ci0000.nupkg) which you can configure appveyor to automatically publish to MyGet.
When your ready to release a stable version, tag the repo with a stable version number (ie. 1.0.0) which will produce DotNetCoreBuild.1.0.0.nupkg. You can configure appveyor to automatically publish all stable versions to nuget (tell appveyor to only publish tagged commits to nuget).
See the following links for more info on setting up appveyor.