We maintain a medium sized windows application developed in vb/c# .net in work. Still now the build and deploy process for this app is manual. I am determined to make this process automated using MSBuild on which i have no knowledge still now.
Our app has a simple build structure, set of projects already grouped into four solutions(.sln) and just need to build the four slns in an order. And then publish a project(which is part of the last sln to be built) to a directory. That is it. A simple process which is already consuming 30 mins of manual build time and i'm pretty sure that this can be accomplished without manual interference using msbuild in atleast 1/4 th of the time.
All my goals set good, i started looking around web for MSBuild resources to accomplish my process but may be looking around many things confused me. Need a pointer or a good explanation on how to start and where to start for my simple scenario. Help is much appreciated.
This sounds like a very easy script to write. Even a batch file would do:
msbuild \path\to\first.sln /p:Configuration=Release msbuild \path\to\second.sln /p:Configuration=Release msbuild \path\to\third.sln /p:Configuration=Release msbuild \path\to\fourth.sln /p:Configuration=Release call deploy
Of course, much better would be to have a server running, say CruiseControl.NET, that gives a web interface into the build status and history.
In MS Build, there are two main control points for the caller: The Target and its Properties. The Target is what to compile, resources, compilation, deployment, etc. The Properties control how that Target is built.
You can control the configuration using the Configuration property (see above). If you open your *.*proj files, you will notice PropertyGroup
elements. These are settable via the commandline using the /p
arg.
Here are the specs for the two args:
/target:<targets> Build these targets in this project. Use a semicolon or a
comma to separate multiple targets, or specify each
target separately. (Short form: /t)
Example:
/target:Resources;Compile
/property:<n>=<v> Set or override these project-level properties. <n> is
the property name, and <v> is the property value. Use a
semicolon or a comma to separate multiple properties, or
specify each property separately. (Short form: /p)
Example:
/property:WarningLevel=2;OutDir=bin\Debug\
Here's a good guide that has a lot of great information on MSBuild, Continuous Integration and CuriseControl.NET. Definitely a good place to start.
来源:https://stackoverflow.com/questions/931478/need-primer-for-a-msbuild-newbie