This is my scenario:
I have a build.bat
that holds:
call tools\nant-0.92\bin\nant.exe -buildfile:deploy.build %* -logfile:deploy_NAnt.log
Part of deploy.build
holds:
<project
name="EdpClient"
basedir="." default="build"
xmlns="http://nant.sf.net/release/0.92/nantContrib.xsd">
<!--INIT -->
...
<property name="version" value="1.48.0.4" />
...
<!--RELEVANT TARGET-->
<target name="BuildProductionApplication" description="Build">
<property
name="publishFolderParameter"
value="/p:PublishDir=${productionPublishFolder}" />
<echo message="Building..." />
<exec
program="${msbuildExe}"
workingdir="." verbose="true">
<arg value="${projectFile}" />
<arg value="/target:Clean;Publish" />
<arg value="${publishFolderParameter}" />
<arg value="/property:ApplicationVersion=${version}" />
<arg value="/property:PublisherName="${publisherName}"" />
</exec>
<echo message="Built" />
</target>
...
</project>
Now my question is:
"build.bat -version 1.48.0.4"
and replace the param
in my structure?-version
param is not supplied the script should throw some
sort of msg back in command line?Thanks to all that help!
This is how i did it:
In deploy.build
file i changed:
<property name="version" value="1.48.0.4" />
to:
<property name="version" value="${arg.version}" />
And this is how build.bat (batch) looks like now:
@ECHO OFF
IF %1.==. GOTO ERROR
ECHO:BUILDING VERSION: %1 ...
CALL tools\nant-0.92\bin\nant.exe -buildfile:deploy.build -D:arg.version=%1 -logfile:deploy_NAnt.log
GOTO END
:ERROR
ECHO.
ECHO Please provide the version parameter (eg. "deploy 1.1.1.1")
ECHO.
GOTO END
:END
Now I can call build 1.48.0.4
command.
It suits all my needs.