views:

219

answers:

3

Hi all:

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.

A: 

Isn't the idea of an automated build that the build is repeateable and without user input?

But, i would guess that powershell has some better options for getting input from a user for this than standard dos.

Bart Janson
A: 

Would it also be possible to query the user input before executing the build file and pass it as a param?

Filburt
@Filburt: yeah I wanted to pass the user input as a parameter, but I'm not sure how it can be passed from command line (DOS) to the msbuild file.
BeraCim
Ahh ... so i got it wrong, thinking you wanted to run msbuild an from a task execute the batch and capture the value prompted from the user.
Filburt
+3  A: 

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.

BeraCim
yup, that's it ... searched MSDN for this just 2 days ago.
Filburt