MSBuild + Team Build 2008 Presentation

You can download MSBuild & Team Build 2008 presentation.

Advertisements

MSBuild Extension Pack Brings 170 Build Tasks

When MSBuild was first released, it was seen as a stopgap measure. Prior to its introduction, building a non-trivial .NET project from the command line was a daunting challenge. Either command line options have to be carefully laid out or third-party libraries like NAnt have to be brought in.

Recently MSBuild Extension Pack was released on CodePlex. Run by Mike Fourie and a team of 5 developers, this successor to FreeToDev MSBuild Extensions has over 170 different tasks for MSBuild. Many of these tasks support a MachineName argument allowing the actions to be performed on a remote machine.

The team summarizes the tasks into these categories:

  • System Items: Certificates, COM+, Console, Date and Time, Drives, Environment Variables, Event Logs, Files and Folders, GAC, Network, Performance Counters, Registry, Services, Sound
  • Code: Assemblies, CAB Files, Code Signing, File Detokenisation, GUID’s, Mathematics, Strings, Threads, Zip
  • Applications: BizTalk 2006, Email, IIS7, MSBuild, SourceSafe, StyleCop, Team Foundation Server, Visual Basic 6, WMI

Team Build and ClickOnce

The other day I got a question: How can I deploy an app via ClickOnce using Team Build?

There is not out of box way to do that, but we can do it with a simple workaround:

we should overload the target AfterCompile in TFSBuild.Proj to call MSBuild Task Publish and can pass the PublishDir property:

<Target Name="AfterCompile">
  <MSBuild
  Condition=" '@(SolutionToBuild)'!='' "
  Projects="@(SolutionToBuild)"
  Properties="Configuration=%(ConfigurationToBuild.FlavorToBuild);
    Platform=%(ConfigurationToBuild.PlatformToBuild);
    SkipInvalidConfigurations=true;
    VCBuildOverride=$(MSBuildProjectDirectory)TFSBuild.vsprops;
    FxCopDir=$(FxCopDir);OutDir=$(OutDir);
    PublishDir=$(OutDir);
    ReferencePath=$(ReferencePath);
    TeamBuildConstants=$(TeamBuildConstants);
    $(CodeAnalysisOption);PublishDir=\qa1SrvdropspublishedVers "
  Targets="Publish" />
</Target>

Configure Team Foundation Build for an Incremental Build

A question I got today: “How can I configure my Team Build for an incremental build?”.

So, it’s simple.

Team Build 2005

Add the PropertyGroup definition to the end of the TFSBuild.proj file, before the closing </project> tag.

Set the following properties:

   <PropertyGroup>      <SkipClean>true</SkipClean>      <SkipInitializeWorkspace>true</SkipInitializeWorkspace>      <ForceGet>false</ForceGet>   </PropertyGroup>

Team Build 2008

Set IncrementalBuild property to true. To do it, add the PropertyGroup definition to the end of the TFSBuild.proj file, before the closing </project> tag.

   <PropertyGroup>      <IncrementalBuild>true</IncrementalBuild>   </PropertyGroup>

Source – msdn:

Team Build 2005: http://msdn.microsoft.com/en-us/library/aa833876(VS.80).aspx

Team Build 2008: http://msdn.microsoft.com/en-us/library/aa833876.aspx

Microsoft Source Analysis for C#

Microsoft announce the public release of a new developer tool –  Source Analysis for C#.

Inside Microsoft this tool’s name is StyleCop and it enforces code style guidelines on the code we write

Source Analysis comes with a set of default rules analyzers covering approximately 200 best practice rules. These rules are full compatible with the default layout settings in Visual Studio 2005 and Visual Studio 2008.

Specifically, these rules cover the following, in no particular order:

  • Layout of elements, statements, expressions, and query clauses
  • Placement of curly brackets, parenthesis, square brackets, etc
  • Spacing around keywords and operator symbols
  • Line spacing
  • Placement of method parameters within method declarations or method calls
  • Standard ordering of elements within a class
  • Formatting of documentation within element headers and file headers
  • Naming of elements, fields and variables
  • Use of the built-in types
  • Use of access modifiers
  • Allowed contents of files
  • Debugging text

After installation, Source Analysis can be run from within the Visual Studio IDE. You can set this up to be run as a part of your build process as documented here. Since this is plugged in as a MsBuild project you can use it in as a part of Team Foundation Build process as well.

Running Source Analysis:

sca1

And the results are:

sca2

Download it from: http://code.msdn.microsoft.com/sourceanalysis

Read full details:http://blogs.msdn.com/sourceanalysis/archive/2008/05/23/announcing-the-release-of-microsoft-source-analysis.aspx

ALM 403: Control Your Database Lifecycle With Data Dude – Agenda

Next week I’ll give a session at TechEd 2008 In Eilat, Israel. The session will introduce you how you can control your database changes and integrate it into your agile development methodology.

Do you want to control your database changes?

Do you want to test your database with unit test and even run static analysis on it?

Do you want better life and easier deployment of database schema changes to production database?

If one of your answers is YES, come to hear me.

Session Details:

  • Session Name: ALM403: Control your Database Lifecycle with Data Dude
  • Level: 400
  • Time: 8/4/2008, 9:00 AM
  • Location: Hilton Hotel, Ofir-Adom Hall

Session’s Agenda:

  • What is Data Dude?
  • Data Dude Features
  • Test Your Database!
  • Build & Deploy (MSBuild & Team Build)
  • Case Study: nuconomy
  • Q & A
  • Summary

Microsoft opened up the meetings application at http://www.face2facemeeting.com/teched/. If you want to meet me and talk with me on development, WCF, LINQ, ALM or anything else – contact me! I’ll be glad to see you!

Meet you there…

Remove Items From ItemGroups In MSBuild

The ability to remove entries from ItemGroups is one of the new features of MSBuild 3.5.

To remove an Item from an ItemGroup in MSBuild 2.0 you would have to create a new ItemGroup from the old one and skip the Item that you needed removed.

In MSBuild 3.5 we can achieve it by using the Remove parameter.

Example:

<ItemGroup>    <Files Include="a.cs" />    <Files Include="b.cs" />    <Files Include="c.cs" />    <Files Include="d.cs" />    <Files Include="e.cs" />    <Files Include="f.cs" />    <Files Include="g.cs" /></ItemGroup>

Some times we want to restrict some data from this group in a target. In order to do it,  we should use the Remove parameter:

<ItemGroup>    <Files Remove="a.cs" />    <Files Remove="e.cs" />    <Files Remove="f.cs" /></ItemGroup>

Read more at msdn.

%d bloggers like this: