I have a property to specify the build drive:
<PropertyGroup>
<BuildDrive Condition="'$(BuildDrive)'==''">Y:</Group>
</PropertyGroup>
If I want to change the build drive using a batch file, I can do as follows:
@echo off
set buildDrive=H:
:: Then call MSBuild
Msbuild /t:BuildTarget %Projectfile% %Logger%
Now I want achieve the same using PowerShell.
I tried as follows in my PowerShell script, build.ps1:
$BuildDrive=H:
MSbuild /t:BuildTarget $ProjectFile $Logger
But it is not honoring the drive letter provided through $BuildDrive. I knew I could achieve it if I passed a parameter as follows, but when the number of properties are more, this approach was not handy.
$BuildDrive=H:
Msbuild /t:BuildTarget /p:BuildDrive=$BuildDrive $projectfile $logger
How do I pass a PropertyGroup
value through PowerShell?