Baccou Bonneville Blogs Eclipse Blog Process Improvement Blog Java Blog Web Design Blog Miscellaneous .NET Blog

01/13/06

English (US)   MSBuild, the Microsoft's build engine  -  Categories: Visual Studio, MSBuild, Build management  -  @ 05:24:57 pm

BrickLet's present MSBuild, the Microsoft's build engine shipped with Visual Studio 2005. It's a build management tool like Ant or NAnt.

[More:]

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.

4 comments

Comments:

Comment from: Suchitra [Visitor]
Hey this is my doubt .How do i get MS Build tool.
PermalinkPermalink 01/24/06 @ 13:55
Comment from: admin [Member] Email · www.baccoubonneville.com
Suchitra,

You can get the latest version of MSBuild by:
- Downloading .NET Framework 2.0 Software Development Kit
Or
- Installing Visual Studio 2005
PermalinkPermalink 01/24/06 @ 14:10
Comment from: Instructor [Visitor] Email · http://www.fancyacar.co.uk
Do we need the Web Deployment Package to be able to see the Project File?
PermalinkPermalink 08/24/07 @ 15:56
Comment from: admin [Member] Email · www.baccoubonneville.com
Web Deployment Projects are MSBuild projects for ASP.NET web sites. It'is only useful to install the Web Deployment Package add-in of Visual Studio 2005 if you want to work with web projects.
PermalinkPermalink 08/27/07 @ 08:09

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email and url)
(Allow users to contact you through a message form (your email will NOT be displayed.))
This is a captcha-picture. It is used to prevent mass-access by robots.

Please enter the characters from the image above. (case insensitive)

Pingbacks:

No Pingbacks for this post yet...

powered by
b2evolution

Credits: blog software | web hosting | monetize