之前有一个最奇怪的错误,我真的很困惑,所以我想我应该写一个自我回答来帮助人们。我的googlefu没有发现任何整齐的东西,所以我们在这里。
这是我的原创台词
<PreBuildEvent>powershell.exe -noninteractive -command "$(solutiondir)\..\PreBuild.ps1" "$(TargetFileName)" "$(ProjectDir)" "$(SolutionDir)"</PreBuildEvent>下面是我的PreBuild.ps1文件:
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";
}由于某些原因,我的脚本中的变量$projectDir同时包含projectdir和解决方案目录。如下所示:
2> Processing files with gulp script.
2> $targetFileName project.dll
2> $projectDir c:\src\sln\project c:\src\sln所以我把它改成了这个
<PreBuildEvent>powershell.exe -noninteractive -command "$(solutiondir)\..\PreBuild.ps1" "$(TargetFileName)" "$(ProjectDir)"</PreBuildEvent>我在VS输出中得到这个错误:The string is missing the terminator: ".
https://stackoverflow.com/questions/44448892
复制相似问题