MSBuild : Architecting and Customized Build System - PowerPoint PPT Presentation

About This Presentation
Title:

MSBuild : Architecting and Customized Build System

Description:

The underlying build engine in Visual Studio 2005. Fully open and published XML file ... You extend the build by writing managed code (tasks and loggers) ... – PowerPoint PPT presentation

Number of Views:673
Avg rating:3.0/5.0
Slides: 25
Provided by: downloadM
Category:

less

Transcript and Presenter's Notes

Title: MSBuild : Architecting and Customized Build System


1
MSBuild Architecting and Customized Build System
Assaf JacobyMicrosoft Sector ManagerAdvantech -
Microsoft Division (Magen) assafj_at_magen.com
2
In This Session
  • MSBuild Architecture
  • MSBuild File Format
  • MSBuild Tips Tricks
  • Team Build

3
Visual Studio .NET 2002/2003
Feeds
4
MSBuild Design Goals
PROJECT FILE


5
The Building BlocksOverall architecture of
MSBuild and Team Build
.NET Framework 2.0 Redist
6
MSBuild in 5 minutes
  • The underlying build engine in Visual Studio
    2005
  • Fully open and published XML file format for
    describing build
  • Visual Studio 2005 build is fully customizable
  • You extend the build by writing managed code
    (tasks and loggers)
  • You dont need the IDE to build Visual Studio
    projects

7
MSBuild File Format
oper/msbuild/2003
MyCoolApp
true
(AppName).exely



(AppName) / itDebugInformation(DebugSymbols)
OutputAssembly(OutputAssembly)/
Sharp.targets /
8
1 Editing a project using Visual Studio 2005
  • Opening a project file for edit is 4 clicks away
    from within Visual Studio!
  • When editing, you get full Intellisense based on
    the Project File Format Schema

Right Click on the project name in Solution
Explorer and Unload Project Right Click on the
unloaded project in Solution Explorer and Edit
Project
9
2 Customizing the Build
  • How do I run pre-build and post-build steps using
    built-in MSBuild features?

sh / /Target r Condition!Exists(_at_(PublishDir))
Directories_at_(PublishDir) /
estinationFolder_at_(PublishDir) /
10
3 Customizing with more granularity
  • How do I run custom steps during arbitrary points
    in the build process for example, what if I
    wanted to delete all files from c\temp\publish
    as a part of Clean target?

sh / DependsOn(CleanDependsOn)MyClean
emoveDir Directories_at_(PublishDir) /
11
MSBuild File Format Basics (cont.)Task
Implementation
public class MakeDir Task private string
directories public string Directories
get return directories se
t directories value public over
ride bool Execute() foreach (strin
g directory in directories)
System.IO.Directory.CreateDirectory(directory)
return true
12
Microsoft.SDC MSBuild Tasks
  • Microsoft research UK has released number of
    extra tasks for MSBuild.
  • These tasks include a number of common thing like
    file management source control etc.
  • You can download it from www.gotdotnet.com

13
4 Using built-in metadata
(FullPath) (RootDir) (Filename) (Extension)

(RelativeDir) (Directory)
(RecursiveDir) (Identity) (ModifiedTime) (C
reationTime)
(AccessedTime)
mGroup y SourceFiles_at_(Compile) DestinationFile
s(Compile.Filename).bak /
14
5 Copying files recursively
  • How can I use MSBuild constructs to copy all the
    contents of a folder from one directory to
    another?

oper/msbuild/2003 s IncludeC\foo\\.cs /
sively C\foocopy ? -- DestinationFolderC\foocopy\(RecursiveDi
r) /
15
BatchingExample Bucketing items
  • Build satellite assemblies by invoking AL once
    per Culture

OutputAssembly(Culture)\Resources.dll /
_at_(EmbeddedResource)
(Culture)
001.bmp
002.bmp
003.wmv
004.bmp
005.wmv
006.xml
16
6 The Task
  • Executes target(s) in another MSBuild project
  • Runs entirely in-process
  • Never builds the same target in the same project
    twice within a build
  • Used for communication between projects
  • Gathering information from referenced projects
  • Building child projects

17
7 Gathering performance summary
  • Somehow, my build has slowed down tremendously.
    I need to find out whats going on!

Use the /ConsoleLoggerParameters switch or the
Diagnostic verbosity to gather performance
statistics.
C\project msbuild build.proj /ConsoleLoggerParam
etersPerformanceSummary
18
What Is Team Build?
  • A fully automated build solution that is easy to
    use and configure
  • Capable of a complete end-to-end build
  • Seamlessly integrated into Visual Studio Team
    System and Team Foundation Server
  • Fully extensible through standard MSBuild
    extensibility mechanisms

In other words, its a build lab in a box
19
Team BuildArchitecture
Drop Location
Team Foundation Client
Create build type Start build View Reports
Application Tier
Build Machine
Team Build Web Services
Data Tier
Sources Work items Team Build data
MSBuild
Team Foundation warehouse
20
Team BuildBuild Execution
Get sources from source control
21
Building In The Future
  • Faster builds through
  • Multi-proc builds
  • Distributed build
  • Extensible mechanisms for achieving incremental
    builds
  • Easier task authoring
  • Example Inline your task code
  • Example Auto ToolTask generator

22
Building In The Future (cont.)
  • Continuous Integration through Team Build
  • Richer IDE integration IDE becomes a visual
    build designer
  • File format enhancements, including XML
    namespaces
  • .SLN file format becomes MSBuild
  • Debugging the build process

23
Summary
  • With MSBuild youll be able to
  • Build a VS project without VS being installed
    since MSBuild ships with the CLR
  • Author a project file with ease since the file
    format is open and backed up by an XSD
  • Customize the build process through our
    comprehensive task extensibility model
  • Do all this without losing any of the
  • RADness you expect from an IDE!

24
??????.... ??????.... ??????... ??????....
Write a Comment
User Comments (0)
About PowerShow.com