Skip to content

Instantly share code, notes, and snippets.

@bjorkstromm
Created September 23, 2017 18:44
Show Gist options
  • Save bjorkstromm/c26371e8e4ce9cab0a6e4069561e2246 to your computer and use it in GitHub Desktop.
Save bjorkstromm/c26371e8e4ce9cab0a6e4069561e2246 to your computer and use it in GitHub Desktop.
gitversion - restore - build - pack /w Cake
#tool gitversion.commandline
DotNetCoreMSBuildSettings msBuildSettings;
Setup(context =>
{
var version = GitVersion();
msBuildSettings = new DotNetCoreMSBuildSettings()
.WithProperty("Version", version.SemVer)
.WithProperty("AssemblyVersion", version.MajorMinorPatch)
.WithProperty("FileVersion", version.MajorMinorPatch);
});
Task("Restore")
.Does(() =>
{
DotNetCoreRestore("./FooLib.sln", new DotNetCoreRestoreSettings {
MSBuildSettings = msBuildSettings
});
});
Task("Build")
.IsDependentOn("Restore")
.Does(() =>
{
DotNetCoreBuild("./FooLib.sln", new DotNetCoreBuildSettings {
Configuration = "Release",
MSBuildSettings = msBuildSettings
});
});
Task("Pack")
.IsDependentOn("Build")
.Does(() =>
{
DotNetCorePack("./FooLib.csproj", new DotNetCorePackSettings {
Configuration = "Release",
MSBuildSettings = msBuildSettings
});
});
Task("Default")
.IsDependentOn("Pack");
RunTarget("Default");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment