In Visual Studio Ultimate 2012, I specify a post-build event that should execute a powershell script. In the Post-build event command line, I specified:
"C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -NoLogo -file "$(SolutionDir)..\docs\create_api_documentation_post_build.ps1"
Now, when I build the project and look at the VS Output window, I find this:
------ Build started: Project: InformationHub, Configuration: Debug Any CPU ------ InformationHub -> C:\...snip...\InformationHub\bin\InformationHub.dll C:\Windows\System32\msxsl.exe : The term 'C:\Windows\System32\msxsl.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\eric\Documents\GitHub\CIH\MvcWebServices\docs\create_api_documentation_post_build.ps1:3 char:1+ C:\Windows\System32\msxsl.exe -o "$scriptPath\InformationHub.html" "$scriptPath\ ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : ObjectNotFound: (C:\Windows\System32\msxsl.exe:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException C:\Windows\System32\msxsl.exe : The term 'C:\Windows\System32\msxsl.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\eric\Documents\GitHub\CIH\MvcWebServices\docs\create_api_documentation_post_build.ps1:4 char:1 + C:\Windows\System32\msxsl.exe -o "$scriptPath\MrdDataServices.html" "$scriptPath ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : ObjectNotFound: (C:\Windows\System32\msxsl.exe:String) [], CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException ------ Build started: Project: TestDataServices, Configuration: Debug Any CPU ------ TestDataServices -> C:\...snip...\TestDataServices\bin\Debug\TestDataServices.dll ========== Build: 2 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
So, it seems it can't find msxsl.exe.
However, when I run that same command (with the $(SolutionDir) keyword expanded) on the commandline (cmd.exe), the powershell script is executed without problem.
Can somebody explain what is going on here and how to make it so that my post-build powershell script will be executed post build?
Thanks
Eric