5

I have the following post-build event:

powershell Set-ExecutionPolicy Unrestricted
powershell -file "$(SolutionDir)Obfuscation\_obfuscate.ps1" "$(SolutionDir)" "$(ProjectDir)"
powershell Set-ExecutionPolicy Restricted

and PS script beginning with:

param
(   
    [string]$slnDir,
    [string]$projectDir
)

when MSBuild trys to run it, my first parameter "$(SolutionDir)" is splitted in two parameters because the solution path contains a space character: D:\Projects\Dion2 Mercurial\repo\Dion2Web\. So my script receives D:\Projects\Dion2 as the first parameter and Mercurial\repo\Dion2Web\ as the second one.

What is the correct way to send those parameters to the script file?

Note: such post-build scripts works fine when script has only one parameter.

1 Answer 1

3

Try adjusting your post build event to use the following:

powershell -file "$(SolutionDir)Obfuscation\_obfuscate.ps1" -slnDir '$(SolutionDir)' -projectDir '$(ProjectDir)'
Sign up to request clarification or add additional context in comments.

1 Comment

You can add the -ExecutionPolicy Bypass parameter if you don't want to change the execution policy permanently.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.