我有一个psake构建脚本中定义的以下测试:

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的传入$版本变量作为文字串“$版本”代替的“1.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
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top