Skip to content

Commit 60415b0

Browse files
committed
changed to use nuget.exe from chocolatey
1 parent 659ddca commit 60415b0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

build.tasks.ps1

+12-6
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ properties {
2424

2525
task default
2626

27-
task RestoreNuGetPackages {
28-
exec { nuget.exe restore $sln_file }
29-
}
30-
3127
task SetChocolateyPath {
3228
$script:chocolateyDir = $null
3329
if ($env:ChocolateyInstall -ne $null) {
@@ -41,6 +37,13 @@ task SetChocolateyPath {
4137
Write-Output "Chocolatey installed at $script:chocolateyDir";
4238
}
4339

40+
task RestoreNuGetPackages -depends SetChocolateyPath {
41+
$chocolateyBinDir = Join-Path $script:chocolateyDir -ChildPath "bin";
42+
$NuGetExe = Join-Path $chocolateyBinDir -ChildPath "NuGet.exe";
43+
44+
exec { & $NuGetExe restore $sln_file }
45+
}
46+
4447
task GitVersion -depends SetChocolateyPath {
4548
$chocolateyBinDir = Join-Path $script:chocolateyDir -ChildPath "bin";
4649
$gitVersionExe = Join-Path $chocolateyBinDir -ChildPath "GitVersion.exe";
@@ -151,7 +154,7 @@ task archive-only {
151154

152155
task pack -depends build, pack-only
153156

154-
task pack-only {
157+
task pack-only -depends SetChocolateyPath {
155158

156159
mkdir $nuget_pack_dir
157160
cp "$nuspec_filename" "$nuget_pack_dir"
@@ -162,7 +165,10 @@ task pack-only {
162165
$Spec.package.metadata.version = ([string]$Spec.package.metadata.version).Replace("{Version}", $script:nugetVersion)
163166
$Spec.Save("$nuget_pack_dir\$nuspec_filename")
164167

165-
exec { nuget pack "$nuget_pack_dir\$nuspec_filename" }
168+
$chocolateyBinDir = Join-Path $script:chocolateyDir -ChildPath "bin";
169+
$NuGetExe = Join-Path $chocolateyBinDir -ChildPath "NuGet.exe";
170+
171+
exec { & $NuGetExe pack "$nuget_pack_dir\$nuspec_filename" }
166172
}
167173

168174
task postbuild -depends pack, archive, coverage-only, coveralls

0 commit comments

Comments
 (0)