Had the strangest error earlier that I was genuinely confused about, so I thought I would write up a self-answer to help people out. My googlefu turned up nothing neatly, so here we are.
This was my original line
<PreBuildEvent>powershell.exe -noninteractive -command "$(solutiondir)\..\PreBuild.ps1" "$(TargetFileName)" "$(ProjectDir)" "$(SolutionDir)"</PreBuildEvent>
and here's my PreBuild.ps1 file:
Param(
[Parameter(Mandatory=$false)][string]$targetFileName,
[Parameter(Mandatory=$false)][string]$projectDir,
[Parameter(Mandatory=$false)][string]$solutionDir
)
process {
Write-Host "`$targetFileName $targetFileName";
Write-Host "`$projectDir $projectDir";
Write-Host "`$solutionDir $solutionDir";
}
For some reason the variable $projectDir
in my script contains both the projectdir and the solutiondir. Like so:
2> Processing files with gulp script.
2> $targetFileName project.dll
2> $projectDir c:\src\sln\project c:\src\sln
So I changed it to this
<PreBuildEvent>powershell.exe -noninteractive -command "$(solutiondir)\..\PreBuild.ps1" "$(TargetFileName)" "$(ProjectDir)"</PreBuildEvent>
and I get this error in VS Output: The string is missing the terminator: ".