01/13/06
MSBuild, the Microsoft's build engine -
Categories: Visual Studio, MSBuild, Build management -
admin
@ 05:24:57 pm
Let's present MSBuild, the Microsoft's build engine shipped with Visual Studio 2005. It's a build management tool like Ant or NAnt.
1. My first MSBuild file...
We want to create a build file that display "Hello World!" on the build console. This build file is named "SayHello.csproj". The extension .csproj is chosen to allow it's opening in Visual Studio. This is the text of this file:
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<Message Text="Hello World!" />
</Target>
</Project>
To run this build using Visual Studio, you must double click on it. You will be asked to create a solution. Ok, why not. Right-click on the SayHello project in the Solution Explorer and choose "Build". In the Output window, you are only shown the following:
------ Build started: Project: SayHello, Configuration: Debug Any CPU ------ ========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
But where is "Hello World!"?
No panic, the default ouput configuration of Visual Studio is set to "minimal". You have to change it to "normal" by using the following menu: Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity. Here we are:
------ Build started: Project: SayHello, Configuration: Debug Any CPU ------
Build started 17/01/2006 11:03:52.
Target Build:
Hello World!
Build succeeded.
Time Elapsed 00:00:00
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
2. In batch mode...
Open a Visual Studio 2005 Command Prompt, go into the directory where you MSBuild file is stored and type MSBuild. You will have the same output as in Visual Studio.
3. How can I edit a MSBuild project file with Visual Studio?
In Editing MSBuild project files in Visual Studio, we learn how to edit an MSBuild project in Visual Studio: you must unload the project to be allowed to edit it! And of course, you will have IntelliSense completion in the XML Editor.
Comments:
You can get the latest version of MSBuild by:
- Downloading .NET Framework 2.0 Software Development Kit
Or
- Installing Visual Studio 2005
Leave a comment:
Pingbacks:
No Pingbacks for this post yet...