msbuild concepts
Post on 23-Jan-2018
340 Views
Preview:
TRANSCRIPT
A Primer to MSBuildMSBuild Fundamentals
Praveen Chamarthi
MSBuild Fundamentals
• Properties• PropertyGroups
• Items• ItemGroups
• Tasks• Targets
Property Property
Property Property
Item
Item Item
Item
PropertyGroup
ItemGroup
Target
TaskTask
TaskTask
Properties
• Properties are the variables of a build script
• Properties are part of a PropertyGroup
• Properties can be referenced using $(<propertyname>) syntax
• Environment variables are available as properties e.g. $(PATH)
Items
• Items are used to define inputs e.g. a source file
• Items are part of a ItemGroup
• Items can be referenced using @(<itemname>) syntax
Tasks
• Tasks are the core to a build process – contains steps to be performed
• Tasks are part of a Target
• Tasks can use items and/or properties as inputs
Targets
• Targets are a collection of Tasks
• Tasks defined in the Target are executed in the defined order
Standard MSBuild Tasks
• Command Line Tool Wrappers• AL, Sgen, Csc, MSBuild, VCBuild, SignFile (Digitally Sign Files)
• File and Directory Manipulation• Copy, Delete, MakeDir, RemoveDir, ReadLinesFromFile, WriteLinesToFile
• Assembly and COM Manipulation• GetAssemblyIdentity, ResolveAssemblyReference, UnregisterAssembly
Extending MSBuild Standard Tasks
• MSBuild Community Tasks is an open source project for MSBuildTasks
• https://github.com/loresoft/msbuildtasks
• Some Tasks include:• FTP, Email, Math, Registry, Regex, Services, SQL Commands, Subversion, ZIP, SourceSafe,
XML
• You can create your own tasks using C#• Extend Microsoft.Build.Framework• Extend Microsoft.Build.Utilities
Debugging Builds
• Use MSBuild command line switches to control the detail in the output
• /verbosity switch sets the level of verbosity a build can generate• Quiet
• Minimal
• Normal
• Detailed
• Diagnostic
Parallel Building with MSBuild
• Using Parallel task in MSBuild Extension Pack
• Using Tasks BuildTargetsInParallel and BuildTargetSetsInParallel
Questions
top related