我试图利用v4发行版中引入的参数特性,但我遇到了一个错误。我似乎只能获得work...and的属性,我尝试过使用单引号和双引号来传递参数。我以这篇文章为例:https://groups.google.com/forum/?fromgroups#!topic/psake-users/UKX3tBzOASE
这里的任何帮助都是非常感谢的--如果有人想尝试在本地运行这些文件,我也可以压缩它们。
执行调用
PowerShell .\_nuget\packages\psake.4.1.0\tools\psake.ps1 sampleScript.ps1 -parameters @{environmentNumber=%TestEnvironmentNumber%}sampleScript.ps1目录:
parameters {
$environmentNumber = $null
}
Task default -depends Print-Properties
Task Print-Properties {
Assert($environmentNumber -ne $null) "environmentNumber should not be null"
Write-Host "Environment Number: $environmentNumber"
}执行输出:
c:\dev\HgSilver\_Provision\NebTestEnvironment>PowerShell .\_nuget\packages\psake.4.1.0\tools\psake.ps1 sampleScript.ps1 -parameters @{environmentNumber=0}
psake version 4.1.0
Copyright (c) 2010 James Kovacs
Warning: Using global variable $framework to set .NET framework version used is deprecated. Instead use Framework function or configuration file psake-config.ps1.
Executing Print-Properties
3/26/2012 4:19:10 PM: An Error Occurred:
Assert: environmentNumber should not be null
At C:\dev\HgSilver\_Provision\NebTestEnvironment\_nuget\packages\psake.4.1.0\tools\psake.psm1:152 char:14
+ throw <<<< ("Assert: " + $failureMessage)
+ CategoryInfo : OperationStopped: (Assert: environ...uld not be null:String) [],
RuntimeException
+ FullyQualifiedErrorId : Assert: environmentNumber should not be null我也在psake论坛上发布了这篇文章,但我正在等待这个话题得到批准:https://groups.google.com/forum/?fromgroups#!forum/psake-users
发布于 2012-03-28 13:03:06
在PSake中没有名为properties的部分,而是使用properties。
https://stackoverflow.com/questions/9879349
复制相似问题