Last active
August 29, 2015 13:56
-
-
Save itsananderson/8858971 to your computer and use it in GitHub Desktop.
Pass Dynamic Flags to NuGet With PowerShell Splatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nuget : Unknown option: '-Build:True' | |
At line:1 char:38 | |
+ nuget pack $project $nugetArgs | |
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ CategoryInfo : NotSpecified: (Unknown option: '-Build:True':String) [], RemoteException | |
+ FullyQualifiedErrorId : NativeCommandError |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Package-Project( | |
[string]$folder, | |
[switch]$build, | |
[switch]$symbols | |
) { | |
pushd $folder | |
$nugetArgs = @{Properties="Configuration=$configuration"} | |
if($build) { $nugetArgs.Build=$True } | |
if($symbols) { $nugetArgs.Symbols=$True } | |
nuget pack @nugetArgs | |
popd | |
} | |
Package-Project ProjectA | |
Package-Project ProjectB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Package-Project( | |
[string]$folder, | |
[switch]$build, | |
[switch]$symbols | |
) { | |
pushd $folder | |
$nugetArgs = "-Properties", "Configuration=$configuration" | |
if($build) { $nugetArgs += "-Build" } | |
if($symbols) { $nugetArgs += "-Symbols" } | |
nuget pack @nugetArgs | |
popd | |
} | |
Package-Project ProjectA | |
Package-Project ProjectB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment