我有一个属性来指定构建驱动器:
<PropertyGroup>
<BuildDrive Condition="'$(BuildDrive)'==''">Y:</Group>
</PropertyGroup>
如果我想使用批处理文件更改构建驱动器,我可以执行以下操作:
@echo off
set buildDrive=H:
:: Then call MSBuild
Msbuild /t:BuildTarget %Projectfile% %Logger%
现在我想使用 PowerShell 实现相同的目标。
我在我的 PowerShell 脚本 build.ps1 中尝试如下:
$BuildDrive=H:
MSbuild /t:BuildTarget $ProjectFile $Logger
但它不支持通过 $BuildDrive 提供的驱动器号。我知道如果按如下方式传递一个参数就可以实现,但是当属性的数量更多时,这种方法就不方便了。
$BuildDrive=H:
Msbuild /t:BuildTarget /p:BuildDrive=$BuildDrive $projectfile $logger
如何PropertyGroup
通过 PowerShell 传递值?