2009-11-20 35 views
0

我有一個psake構建腳本定義瞭如下測試:參數傳遞2.0

task package -depends create_wix_content_fragment { 

    & $candle -dProductName=Foo ` 
      -dVersion=$version ` 
      -dProductID=0cd64670-5769-4e34-8b21-c6242e7ca5a2 ` 
      -dUpgradeCode=307601e9-4eea-4b5c-938a-354115d5c419 ` 
      -dAppPool=FooAppPool ` 
      -dInstallDirectory=Foo ` 
      -ext WixIISExtension ` 
      -ext WixUIExtension ` 
      $wix_shell ` 
      $build_output_dir\WebContent.wxs 
} 

出於某種原因,PowerShell的傳入$ version變量爲文字字符串「$版本」,而不是價值「 1.0.0.0" 。

我該如何預防?

回答

0

得到它,是能夠通過修改上述這樣才能得到正確的參數:

task package -depends create_wix_content_fragment { 
    $version_parameter = "-dVersion={0}" -f $version 

    & $candle -dProductName=Foo ` 
      $version_parameter ` 
      -dProductID=0cd64670-5769-4e34-8b21-c6242e7ca5a2 ` 
      -dUpgradeCode=307601e9-4eea-4b5c-938a-354115d5c419 ` 
      -dAppPool=FooAppPool ` 
      -dInstallDirectory=Foo ` 
      -ext WixIISExtension ` 
      -ext WixUIExtension ` 
      $wix_shell ` 
      $build_output_dir\WebContent.wxs 
}