Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8620055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:29:22+00:00 2026-06-12T06:29:22+00:00

I have a powershell script that works wonderfully from the powershell shell and from

  • 0

I have a powershell script that works wonderfully from the powershell shell and from a cmd window, and now I am trying to launch it from a post-build step in Visual Studio.

After several different variations of trying to get this to lunch and run successfully, I currently have the following configuration for the “Command Line” property of the “Post-Build Event” in VS2010.

This is all on one line in the Post-Build configuration, but I’ve wrapped the text here just for readability:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive
-File "$(SolutionDir)testScript.ps1"
-ConfigurationFile "$(SolutionDir)configuration.txt"
-SolutionDir "$(SolutionDir)"
-Platform "$(Platform)"
-Configuration "$(Configuration)"

The powershell script expects 4 mandatory parameters: ConfigurationFile, SolutionDir, Platform, and Configuration. As you can see, I am providing each of those parameters above, and am enclosing them in double quotes to protect against spaces in the values.

In VS2010, the SolutionDir macro expands to a path that has spaces, Platform expands to “Release”, and Configuration expands to “Win32”.

When the post-build step executes, this is the error I get:

testScript.ps1 : Cannot process command because of one or more missing
mandatory parameters: Platform Configuration.
    + CategoryInfo          : InvalidArgument: (:) [testScript.ps1], 
    ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingMandatoryParameter,testScript.ps1

…any ideas what I could be missing? It is apparently able to find the script in $(SolutionDir), but I can’t tell whether it’s picking up any of the command line arguments. Could the trailing ‘\’ character in $(SolutionDir) be hanging this up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:29:23+00:00Added an answer on June 12, 2026 at 6:29 am

    The variable $(SolutionDir), since it is a directory ends in a backslash ‘\’. So, when the variable is expanded, the argument for -SolutionDir "$(SolutionDir)" looks like this:

    -SolutionDir "c:\Your Solution Dir\"
    

    when this is parsed the final slash effectively escapes the closing quote and the shell parser does not see the end of the argument, so the parameter to -SolutionDir “sucks in” the rest of the arguments into the SolutionDir argument. You can fix this by escaping the final backslash with another one by adding a trailing slash:

    -SolutionDir “$(SolutionDir)\”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a powershell script that modifies transport rules. It works perfectly from powershell
I have a powershell script that works fine if I run it from an
I have a fairly simple Psake build script (default.ps1) that calls Invoke-Psake from within
I have a PowerShell script that uses du.exe ( Disk Usage originally from Sysinternals)
We have a powershell build script that calls out to other scripts that is
I have a powershell script that will generate an email for users whose password
I have a complex Powershell script that gets run as part of a SQL
I have developed a Powershell script that needs to be run automatically daily. This
I have a function in a powershell script that is supposed to untar my
I trying to write a PowerShell script (learning at the same time). I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.