1- #addin "nuget:?package=Cake.MinVer&version=1.0.0 "
2- #addin "nuget:?package=Cake.Args&version=1.0.0 "
1+ #addin "nuget:?package=Cake.MinVer&version=1.0.1 "
2+ #addin "nuget:?package=Cake.Args&version=1.0.1 "
33
44var target = ArgumentOrDefault < string > ( "target" ) ?? "pack" ;
55var buildVersion = MinVer ( s => s . WithTagPrefix ( "v" ) . WithDefaultPreReleasePhase ( "preview" ) ) ;
66
77Task ( "clean" )
88 . Does ( ( ) =>
99{
10- CleanDirectory ( "./build/artifacts" ) ;
11- CleanDirectories ( "./src/**/bin" ) ;
12- CleanDirectories ( "./src/**/obj" ) ;
13- CleanDirectories ( "./test/**/bin" ) ;
14- CleanDirectories ( "./test/**/obj" ) ;
10+ CleanDirectories ( "./artifact/**" ) ;
11+ CleanDirectories ( "./**/^{bin,obj}" ) ;
1512} ) ;
1613
1714Task ( "restore" )
@@ -26,28 +23,18 @@ Task("restore")
2623
2724Task ( "build" )
2825 . IsDependentOn ( "restore" )
29- . Does ( ( ) =>
26+ . DoesForEach ( new [ ] { "Debug" , "Release" } , ( configuration ) =>
3027{
3128 DotNetCoreBuild ( "./Ookii.Dialogs.Wpf.sln" , new DotNetCoreBuildSettings
3229 {
33- Configuration = "Debug" ,
34- NoRestore = true ,
35- NoIncremental = false ,
36- ArgumentCustomization = args =>
37- args . AppendQuoted ( $ "-p:Version={ buildVersion . Version } ")
38- . AppendQuoted ( $ "-p:FileVersion={ buildVersion . FileVersion } ")
39- . AppendQuoted ( $ "-p:ContinuousIntegrationBuild=true")
40- } ) ;
41-
42- DotNetCoreBuild ( "./Ookii.Dialogs.Wpf.sln" , new DotNetCoreBuildSettings
43- {
44- Configuration = "Release" ,
30+ Configuration = configuration ,
4531 NoRestore = true ,
4632 NoIncremental = false ,
47- ArgumentCustomization = args =>
48- args . AppendQuoted ( $ "-p:Version={ buildVersion . Version } ")
49- . AppendQuoted ( $ "-p:FileVersion={ buildVersion . FileVersion } ")
50- . AppendQuoted ( $ "-p:ContinuousIntegrationBuild=true")
33+ MSBuildSettings = new DotNetCoreMSBuildSettings ( )
34+ . WithProperty ( "Version" , buildVersion . Version )
35+ . WithProperty ( "AssemblyVersion" , buildVersion . AssemblyVersion )
36+ . WithProperty ( "FileVersion" , buildVersion . FileVersion )
37+ . WithProperty ( "ContinuousIntegrationBuild" , BuildSystem . IsLocalBuild ? "false" : "true" )
5138 } ) ;
5239} ) ;
5340
@@ -82,10 +69,10 @@ Task("pack")
8269 NoBuild = true ,
8370 IncludeSymbols = true ,
8471 IncludeSource = true ,
85- OutputDirectory = "./build/artifacts " ,
86- ArgumentCustomization = args =>
87- args . AppendQuoted ( $ "-p: Version= { buildVersion . Version } " )
88- . AppendQuoted ( $ "-p: PackageReleaseNotes= { releaseNotes } " )
72+ OutputDirectory = "./artifact/nuget " ,
73+ MSBuildSettings = new DotNetCoreMSBuildSettings ( )
74+ . WithProperty ( " Version" , buildVersion . Version )
75+ . WithProperty ( " PackageReleaseNotes" , releaseNotes )
8976 } ) ;
9077
9178 DotNetCorePack ( "./src/Ookii.Dialogs/Ookii.Dialogs.csproj" , new DotNetCorePackSettings
@@ -95,14 +82,14 @@ Task("pack")
9582 NoBuild = true ,
9683 IncludeSymbols = false ,
9784 IncludeSource = false ,
98- OutputDirectory = "./build/artifacts " ,
99- ArgumentCustomization = args =>
100- args . AppendQuoted ( $ "-p: Version= { buildVersion . Version } " )
101- . AppendQuoted ( $ "-p: PackageReleaseNotes= { releaseNotes } " )
85+ OutputDirectory = "./artifact/nuget " ,
86+ MSBuildSettings = new DotNetCoreMSBuildSettings ( )
87+ . WithProperty ( " Version" , buildVersion . Version )
88+ . WithProperty ( " PackageReleaseNotes" , releaseNotes )
10289 } ) ;
10390} ) ;
10491
105- Task ( "publish " )
92+ Task ( "push " )
10693 . IsDependentOn ( "pack" )
10794 . Does ( context =>
10895{
@@ -126,7 +113,7 @@ Task("publish")
126113 ApiKey = apiKey ,
127114 } ;
128115
129- foreach ( var nugetPackageFile in GetFiles ( "./build/artifacts /*.nupkg" ) )
116+ foreach ( var nugetPackageFile in GetFiles ( "./artifact/nuget /*.nupkg" ) )
130117 {
131118 DotNetCoreNuGetPush ( nugetPackageFile . FullPath , nugetPushSettings ) ;
132119 }
0 commit comments