We can define a target in a csproj file and then specify that target when we call msbuild from the command line. That looks like this:
my.csproj
<Target Name="CopyFiles"> <Copy SourceFiles="@(MySourceFiles)" DestinationFolder="c:\MyProject\Destination" /> </Target> msbuild
msbuild my.csproj /t:CopyFiles The CopyFiles targets asks msbuild to run the Copy task.
What if we don't want to edit the csproj file. How can we define a target just from the command line? Alternatively, using only the command line, how can we ask msbuild to run just one or maybe two tasks?
Pseudo-Code
msbuild my.csproj /t:"Copy SourceFiles=@(MySourceFiles) DestinationFolder=..."