Open dcbroad3 opened 8 years ago
When we define the LocalGitPath, the GitPath is set in MSBuild.Bower.targets.
<PropertyGroup Condition=" '$(LocalGitPath)' != '' "> <GitPath>$(LocalGitPath)</GitPath> <EnsureGitInPathCmd>SETLOCAL & SET PATH=$(LocalGitPath);%PATH% &</EnsureGitInPathCmd> </PropertyGroup>
Then, GitPath is not empty, so we skip the Exec that follows:
<Exec Command="$(WINDIR)\system32\where.exe git" ContinueOnError="true" IgnoreExitCode="true" ConsoleToMsBuild="true" Condition=" '$(GitPath)' == '' "> <Output TaskParameter="ExitCode" PropertyName="WhereExitCode"/> <Output TaskParameter="ConsoleOutput" PropertyName="GitExecutable" /> </Exec>
However, when we get to the PropertyGroup that follows the Exec, the Condition is met because $(WhereExitCode) is 0 (from a previous target, presumably), but $(GitExecutable) is empty, so an error is thrown when GetDirectoryName is called:
<PropertyGroup Condition=" '$(WhereExitCode)' == '0' "> <GitPath>$([System.IO.Path]::GetDirectoryName('$(GitExecutable)'))</GitPath> </PropertyGroup>
I propose adding another condition; the below seems to work for me:
<PropertyGroup Condition=" '$(GitPath)' == '' AND '$(WhereExitCode)' == '0' "> <GitPath>$([System.IO.Path]::GetDirectoryName('$(GitExecutable)'))</GitPath> </PropertyGroup>
Of course, WhereExitCode could also be renamed to something unique.
When we define the LocalGitPath, the GitPath is set in MSBuild.Bower.targets.
Then, GitPath is not empty, so we skip the Exec that follows:
However, when we get to the PropertyGroup that follows the Exec, the Condition is met because $(WhereExitCode) is 0 (from a previous target, presumably), but $(GitExecutable) is empty, so an error is thrown when GetDirectoryName is called:
I propose adding another condition; the below seems to work for me:
Of course, WhereExitCode could also be renamed to something unique.