Search code examples
command-linemsbuilddosmsbuild-task

Reading/Capturing DOS input for use in MsBuild


How do I capture/read DOS input for use in MsBuild?

EDITED for clarification

Currently I have 2 files. One batch file, the other is the core.msbuild file which contains the msbuild stuff. I want to be able to capture an extra user input e.g. an output directory, from the windows command prompt (when the build file is executed) and send it to the msbuild file (and set it to a PropertyGroup). %1 is already taken so I'm thinking to use %2.

Like the following:

build.bat param1 param2

param2 is the one im trying to capture and do the above.

Thanks.


Solution

  • Got it...

    In the build.bat file, append this to a build string:

    ... /p:customOutputDir="%1"
    

    In MsBuild file:

    <PropertyGroup>
        <OutputDir>$(customOutputDir)</OutputDir>
    </PropertyGroup>
    

    Then OutputDir can be used in Targets.

    Thanks.