Skip to content

Commit

Permalink
Merge pull request #3248 from jmyersmsft/ignoreUnsetBuildConfig
Browse files Browse the repository at this point in the history
Ignore configurationToPack if it is literally $(BuildConfiguration)
  • Loading branch information
jmyersmsft authored Dec 13, 2016
2 parents e63952a + 8852891 commit c6c8968
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
24 changes: 20 additions & 4 deletions Tasks/NugetPackager/NuGetPackager.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,22 @@ if (-not $nuGetPath)
throw (Get-LocalizedString -Key "Unable to locate {0}" -ArgumentList 'nuget.exe')
}

$allBuildProps = @()

# We set the default to $(BuildConfiguration) so the task works by default with the Visual
# Studio Build / MSBuild template. Unfortunately, that causes it to *not* work by default
# with the empty build template, so we just ignore the value if it wasn't substituted with
# something useful.
if($configurationToPack -and $configurationToPack -ne '$(BuildConfiguration)')
{
$allBuildProps += @("Configuration=$configurationToPack")
}

if ($buildProperties)
{
$allBuildProps += @($buildProperties -split ";")
}

$initialNuGetExtensionsPath = $env:NUGET_EXTENSIONS_PATH
try
{
Expand All @@ -187,12 +203,12 @@ try
$slnFolder = $(Get-ItemProperty -Path $fileToPackage -Name 'DirectoryName').DirectoryName
#Setup Nuget

$buildProps = "Configuration=$configurationToPack";
if ([string]::IsNullOrEmpty($buildProperties) -eq $false)
$argsPack = "pack `"$fileToPackage`" -OutputDirectory `"$outputdir`""

if ($allBuildProps)
{
$buildProps = ($buildProps + ";" + $buildProperties)
$argsPack += " -Properties $($allBuildProps -join ";")"
}
$argsPack = "pack `"$fileToPackage`" -OutputDirectory `"$outputdir`" -Properties $buildProps";

if($b_includeReferencedProjects)
{
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NugetPackager/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 0,
"Minor": 1,
"Patch": 69
"Patch": 70
},
"demands": [
"Cmd"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/NugetPackager/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"version": {
"Major": 0,
"Minor": 1,
"Patch": 69
"Patch": 70
},
"demands": [
"Cmd"
Expand Down

0 comments on commit c6c8968

Please sign in to comment.