我想在 Visual Studio 的构建事件中使用 powershell 脚本,并且我需要使用在 Visual Studio 本身中定义的一些宏。
这是我的 powershell 脚本示例:
"Updating version for Project:"
"$ProjectDir"
然后在项目的预构建事件中,我以这种方式调用它:
powershell.exe -file "$(SolutionDir)Resources\UpdateVersion.ps1" -path $(SolutionDir)
构建项目时,我正确调用了脚本,但包含项目路径的字符串为空。
有没有办法将所有 Visual Studio 宏传递给 powershell 脚本,而不将它们显式地作为脚本参数传递(我必须使用很多宏,这会很乏味)?