I usually have two files, one with properties, another with targets. I also try to store all the needed properties in a file, so there is no need to pass anything from command line.
If you call the file with targets main.msbuild
you can call it like that
msbuild main.msbuild /t:Default
where /t
switch corresponds to the target name, and this is how you can specify which target to execute, so no parameters with /p
needed.
From examples, this is how the default target may look like
<Target Name="Default">
<!-- Install a service on a Remote Machine -->
<MSBuild.ExtensionPack.Computer.WindowsService
TaskAction="Install"
ServiceName="__TestService1"
User="$(User)"
Password="$(password)"
ServicePath="c:\WINDOWS\system32\taskmgr.exe"
RemoteUser="$(RemoteUser)"
RemoteUserPassword="$(RemoteUserPassword)"
MachineName="$(RemoteMachine)" />
</Target>