开发者

Reading/Capturing DOS input for use in MsBuild

开发者 https://www.devze.com 2022-12-16 21:22 出处:网络
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

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.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号