Permalink
3744 lines (1563 sloc) 81.4 KB
    MSBuild.Community.Tasks

InstallAspNet (AspNet.InstallAspNet)

Description

Installs and register script mappings for ASP.NET

Example

Install the latest version of ASP.NET on the server:

   <InstallAspNet /> 

AssemblyInfo

Description

Generates an AssemblyInfo files

Example

Generates a common version file.

  <AssemblyInfo CodeLanguage="CS"  
            OutputFile="VersionInfo.cs" 
            AssemblyVersion="1.0.0.0" 
            AssemblyFileVersion="1.0.0.0" />

Generates a complete version file.

  <AssemblyInfo CodeLanguage="CS"  
            OutputFile="$(MSBuildProjectDirectory)\Test\GlobalInfo.cs" 
            AssemblyTitle="AssemblyInfoTask" 
            AssemblyDescription="AssemblyInfo Description"
            AssemblyConfiguration=""
            AssemblyCompany="Company Name, LLC"
            AssemblyProduct="AssemblyInfoTask"
            AssemblyCopyright="Copyright (c) Company Name, LLC 2006"
            AssemblyTrademark=""
            ComVisible="false"
            CLSCompliant="true"
            Guid="d038566a-1937-478a-b5c5-b79c4afb253d"
            AssemblyVersion="1.0.0.0" 
            AssemblyFileVersion="1.0.0.0" />

Generates a complete version file for C++/CLI.

  <AssemblyInfo CodeLanguage="CPP"  
            OutputFile="$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cpp"
            AssemblyTitle="MyAssembly" 
            AssemblyDescription="MyAssembly Description"
            AssemblyConfiguration="$(Configuration)"
            AssemblyCompany="Company Name, LLC"
            AssemblyProduct="MyAssembly"
            AssemblyCopyright="Copyright (c) Company Name, LLC 2008"
            AssemblyTrademark=""
            ComVisible="false"
            CLSCompliant="true"
            Guid="d038566a-1937-478a-b5c5-b79c4afb253d"
            AssemblyVersion="1.0.0.0" 
            AssemblyFileVersion="1.0.0.0"
            UnmanagedCode="true" />

Attrib

Description

Changes the attributes of files and/or directories

Example

Make file Readonly, Hidden and System.

  <Attrib Files="Test\version.txt" 
            ReadOnly="true" Hidden="true" System="true"/>

Clear Hidden and System attributes.

  <Attrib Files="Test\version.txt" 
            Hidden="false" System="false"/>

Make file Normal.

  <Attrib Files="Test\version.txt" 
            Normal="true"/>

ByteDescriptions

Description

Describes certain byte measurements as nice strings.

No example given

The developer of this task did not add an example in the summary documentation.


Computer

Description

Provides information about the build computer.

Example

Get build computer information.

  <Computer>
  <Output TaskParameter="Name" PropertyName="BuildMachineName" />
  <Output TaskParameter="IPAddress" PropertyName="BuildMachineIPAddress" />
  <Output TaskParameter="IPAddressV4" PropertyName="BuildMachineIPAddressV4" />
  <Output TaskParameter="OSPlatform" PropertyName="BuildMachineOSPlatform" />
  <Output TaskParameter="OSVersion" PropertyName="BuildMachineOSVersion" />
  </Computer>

Beep

Description

A task to play the sound of a beep through the console speaker.

Example

To play the sound of a beep at a frequency of 800 hertz and for a duration of 200 milliseconds, use

  <Beep />

DeleteTree

Description

Delete a directory tree. This task supports wild card directory selection.

Example

Delete all bin and obj directories.

  <DeleteTree Directories="**\bin;**\obj" />

Delete all bin and obj directories that start with MSBuild.Community.

  <DeleteTree Directories="MSBuild.Community.*\**\bin;MSBuild.Community.*\**\obj" />

DependencyGraph (DependencyGraph.DependencyGraph)

Description

Reads a set of project files (.csproj, .vbproj) in InputFiles and generate a GraphViz style syntax. You can paste the result of the graphs in places like http://graphviz-dev.appspot.com/ to see your chart or run the file using the GraphViz tool http://www.graphviz.org/

Example

   <ItemGroup>
   <Dependency Include="Project01.csproj" />
   </ItemGroup>
        
   <Target Name="Default">
   <DependencyGraph InputFiles="@(Dependency)" IsIncludeProjectDependecies="true" ExcludeReferences="^System" />
   </Target>

Result: digraph { subgraph ProjectReferences { node [shape=box]; "{4993C164-5F2A-4831-A5B1-E5E579C76B28}" [label="Project01"]; "{1B5D5300-8070-48DB-8A81-B39764231954}" [label="Project03"]; "{E7D8035C-3CEA-4D9C-87FD-0F5C0DB5F592}" [label="Project02"]; "{7DBCDEE7-D048-432E-BEEB-928E362E3063}" [label="Project03"]; } "{4993C164-5F2A-4831-A5B1-E5E579C76B28}" -> "Microsoft.CSharp"; "{1B5D5300-8070-48DB-8A81-B39764231954}" -> "Microsoft.CSharp"; "{E7D8035C-3CEA-4D9C-87FD-0F5C0DB5F592}" -> "Microsoft.CSharp"; "{7DBCDEE7-D048-432E-BEEB-928E362E3063}" -> "Microsoft.CSharp"; "{4993C164-5F2A-4831-A5B1-E5E579C76B28}" -> "{1B5D5300-8070-48DB-8A81-B39764231954}"; "{4993C164-5F2A-4831-A5B1-E5E579C76B28}" -> "{E7D8035C-3CEA-4D9C-87FD-0F5C0DB5F592}"; "{E7D8035C-3CEA-4D9C-87FD-0F5C0DB5F592}" -> "{7DBCDEE7-D048-432E-BEEB-928E362E3063}"; }


ProjectFileParser (DependencyGraph.ProjectFileParser)

Description

Very simple parser that gets reference and assembly name information from project files

No example given

The developer of this task did not add an example in the summary documentation.


BaseReference (DependencyGraph.BaseReference)

Description

Base class for all references

No example given

The developer of this task did not add an example in the summary documentation.


AssemblyReference (DependencyGraph.AssemblyReference)

Description

Represents an assembly reference inside a project file

No example given

The developer of this task did not add an example in the summary documentation.


ProjectReference (DependencyGraph.ProjectReference)

Description

Represents a project reference inside a project file

No example given

The developer of this task did not add an example in the summary documentation.


EmbedNativeResource

Description

A task for embedded native resource.

No example given

The developer of this task did not add an example in the summary documentation.


FtpUpload

Description

Uploads a group of files using File Transfer Protocol (FTP).

Example

Upload a file.

  <FtpUpload 
            LocalFile="MSBuild.Community.Tasks.zip" 
            RemoteUri="ftp://localhost/" />

Upload all the files in an ItemGroup:

  <FtpUpload
            Username="username"
            Password="password"
            UsePassive="true"
            RemoteUri="ftp://webserver.com/httpdocs/"
            LocalFiles="@(FilesToUpload)"
            RemoteFiles="@(FilesToUpload->'%(RecursiveDir)%(Filename)%(Extension)')" />

IFtpWebRequestCreator

Description

Describes a factory for IFtpWebRequest.

No example given

The developer of this task did not add an example in the summary documentation.


IFtpWebRequest

Description

This class references an interface that looks like FtpWebRequest in order to support unit testing without an actual FTP Server.

No example given

The developer of this task did not add an example in the summary documentation.


RealFtpWebRequest

Description

An adapter to make the real FtpWebRequest look like an IFtpWebRequest.

No example given

The developer of this task did not add an example in the summary documentation.


FtpClientTaskBase (Ftp.FtpClientTaskBase)

Description

Ftp client base class.

No example given

The developer of this task did not add an example in the summary documentation.


FtpCreateRemoteDirectory (Ftp.FtpCreateRemoteDirectory)

Description

Creates a full remote directory on the remote server if not exists using the File Transfer Protocol (FTP). This can be one directory or a full path to create.

Example

Create remote directory:

  <FtpCreateRemoteDirectoty 
            ServerHost="ftp.myserver.com"
            Port="42"
            RemoteDirectory="Directory\Subdirectory\MyOtherSubdirectory"
            Username="user"
            Password="p@ssw0rd"
        />

FtpDirectoryExists (Ftp.FtpDirectoryExists)

Description

Determ if a remote directory exists on a FTP server or not.

Example

Determ of Directory\1 exists:

  <Target Name="CheckIfDirectoryExists">
  <FtpDirectoryExists 
                ServerHost="ftp.myserver.com"
                Port="42"
                RemoteDirectory="1\2\3"
                Username="user"
                Password="p@ssw0rd"
            >
  <Output TaskParameter="Exists" PropertyName="Exists" /> 
  </FtpDirectoryExists>
  <Message Text="Directory '1\2\3' exists: $(Exists)"/>

If the directory exists on the server you should see the following output in the console: Directory '1\2\3' exists: true


FtpException (Ftp.FtpException)

Description

Exception returned by FTP server.

No example given

The developer of this task did not add an example in the summary documentation.


FtpEntry (Ftp.FtpEntry)

Description

Represents an remote file or directory on a FTP server.

No example given

The developer of this task did not add an example in the summary documentation.


FtpReply (Ftp.FtpReply)

Description

Represenatation of a FTP reply message.

No example given

The developer of this task did not add an example in the summary documentation.


FtpUploadDirectoryContent (Ftp.FtpUploadDirectoryContent)

Description

Uploads a full directory content to a remote directory.

Example

Uploads directory content, including all subdirectories and subdirectory content:

  <Target Name="DeployWebsite">
  <FtpUploadDirectoryContent 
                ServerHost="ftp.myserver.com"
                Port="42"
                Username="user"
                Password="p@ssw0rd"
                LocalDirectory="c:\build\mywebsite"
                RemoteDirectory="root\www\mywebsite"
                Recursive="true"
            />

To go a little step further. If the local directory looked like this:

        [mywebsite]
            [images]
                1.gif
                2.gif
                3.gif
            [js]
                clientscript.js
                nofocus.js
            [css]
                print.css
                main.css
            index.htm
            contact.htm
            downloads.htm
        
        All directories and there content will be uploaded and a excact copy of the content of mywebsite directory will be created remotely.
        
        If  is set the false; only index.htm, contact.htm and downloads.htm will be uploaded and no subdirectories will be created remotely.

UninstallStatus (Fusion.UninstallStatus)

Description

The status of an uninstall.

No example given

The developer of this task did not add an example in the summary documentation.


FusionWrapper (Fusion.FusionWrapper)

Description

A class wrapping fusion api calls

No example given

The developer of this task did not add an example in the summary documentation.


GitCommitDate (Git.GitCommitDate)

Description

A task for git to get the current commit datetime.

No example given

The developer of this task did not add an example in the summary documentation.


GitClient (Git.GitClient)

Description

A task for Git commands.

No example given

The developer of this task did not add an example in the summary documentation.


GitDescribe (Git.GitDescribe)

Description

A task for git to get the most current tag, commit count since tag, and commit hash.

No example given

The developer of this task did not add an example in the summary documentation.


GitBranch (Git.GitBranch)

Description

A task to get the name of the branch or tag of git repository

No example given

The developer of this task did not add an example in the summary documentation.


GitCommits (Git.GitCommits)

Description

A task for git to retrieve the number of commits on a revision.

No example given

The developer of this task did not add an example in the summary documentation.


GitPendingChanges (Git.GitPendingChanges)

Description

A task for git to detect if there are pending changes

No example given

The developer of this task did not add an example in the summary documentation.


GitVersion (Git.GitVersion)

Description

A task for git to get the current commit hash.

No example given

The developer of this task did not add an example in the summary documentation.


ChmCompiler (HtmlHelp.ChmCompiler)

Description

Html Help 1x compiler task.

No example given

The developer of this task did not add an example in the summary documentation.


HxCompiler (HtmlHelp.HxCompiler)

Description

A Html Help 2.0 compiler task.

No example given

The developer of this task did not add an example in the summary documentation.


InnoSetup

Description

MSBuild task to create installer with InnoSetup

Example

Create installer

  <InnoSetup 
                ScriptFile="setup.iss"
                OutputFileName="MySetup.exe"
                OutputPath="C:\SetupDir"
                Quiet="True" />

CssCompress (JavaScript.CssCompress)

Description

MSBuild task to minimize the size of a css file.

No example given

The developer of this task did not add an example in the summary documentation.


CssCompressor (JavaScript.CssCompressor)

Description

Work in progress ...

No example given

The developer of this task did not add an example in the summary documentation.


MergeModes

Description

Defines the modes for merging files.

No example given

The developer of this task did not add an example in the summary documentation.


Merge

Description

Merge files into the destination file.

Example

Merge CSS files together for better browser performance.

  <Merge Mode="TextLine" 
            SourceFiles="Main.css;Login.css" 
            DestinationFile="All.css" />

HttpRequest (Net.HttpRequest)

Description

Makes an HTTP request, optionally validating the result and writing it to a file.

Example

Example of a update request ensuring "Database upgrade check completed successfully." was returned.

  <HttpRequest Url="http://mydomain.com/index.php?checkdb=1" 
                EnsureResponseContains="Database upgrade check completed successfully." 
                FailOnNon2xxResponse="true" />

NuGetBase (NuGet.NuGetBase)

Description

A base class for NuGet tasks.

No example given

The developer of this task did not add an example in the summary documentation.


NuGetDelete (NuGet.NuGetDelete)

Description

Deletes a package with a specific version. It can be useful if the server has disallow to overwrite existing packages.

No example given

The developer of this task did not add an example in the summary documentation.


NuGetInstall (NuGet.NuGetInstall)

Description

Installs a package using the specified sources.

No example given

The developer of this task did not add an example in the summary documentation.


NuGetPack (NuGet.NuGetPack)

Description

Creates a NuGet package based on the specified nuspec or project file.

No example given

The developer of this task did not add an example in the summary documentation.


NuGetPush (NuGet.NuGetPush)

Description

Pushes a package to the server and optionally publishes it.

No example given

The developer of this task did not add an example in the summary documentation.


NuGetRestore (NuGet.NuGetRestore)

Description

Downloads and unzips (restores) any packages missing from the packages folder.

No example given

The developer of this task did not add an example in the summary documentation.


NuGetUpdate (NuGet.NuGetUpdate)

Description

Updates packages

No example given

The developer of this task did not add an example in the summary documentation.


RegexCompiler

Description

Compiles regular expressions and saves them to disk in an assembly.

Example

Creates an assembly with the compiled regular expressions.

\G[^<]+ RegexOptions.Singleline | RegexOptions.Multiline \G<%--(([^-]*)-)*?-%> RegexOptions.Singleline | RegexOptions.Multiline \G<%(?![@%])(?<code>.*?)%> RegexOptions.Singleline | RegexOptions.Multiline MSBuild.Community.RegularExpressions

BuildAssembler (Sandcastle.BuildAssembler)

Description

BuildAssembler task for Sandcastle.

No example given

The developer of this task did not add an example in the summary documentation.


SandcastleToolBase (Sandcastle.SandcastleToolBase)

Description

A base class for Sandcastle Tools,

No example given

The developer of this task did not add an example in the summary documentation.


ChmBuilder (Sandcastle.ChmBuilder)

Description

ChmBuilder task for Sandcastle.

No example given

The developer of this task did not add an example in the summary documentation.


DBCSFix (Sandcastle.DBCSFix)

Description

DBCSFix task for Sandcastle.

No example given

The developer of this task did not add an example in the summary documentation.


MRefBuilder (Sandcastle.MRefBuilder)

Description

MRefBuilder task for Sandcastle.

No example given

The developer of this task did not add an example in the summary documentation.


Sandcastle (Sandcastle.Sandcastle)

Description

The Sandcastle task.

Example

Create the Html Help for MSBuild Community Task project.

  <Sandcastle TopicStyle="vs2005"
            WorkingDirectory="$(MSBuildProjectDirectory)\Help"
            Assemblies="@(Assemblies)"
            Comments="@(Comments)"
            References="@(References)"
            ChmName="MSBuildTasks"
            HxName="MSBuildTasks" />

SandcastleEnviroment (Sandcastle.SandcastleEnviroment)

Description

A class representing the sandcastle enviroment.

No example given

The developer of this task did not add an example in the summary documentation.


XslTransform (Sandcastle.XslTransform)

Description

XslTransform task for Sandcastle.

No example given

The developer of this task did not add an example in the summary documentation.


IFilesSystem (Services.IFilesSystem)

Description

The contract for a service that will provide access to the file system.

No example given

The developer of this task did not add an example in the summary documentation.


FileSystem (Services.FileSystem)

Description

Provides access to the file system.

No example given

The developer of this task did not add an example in the summary documentation.


GacUtilCommands

Description

The list of the commands available to the GacUtil Task

No example given

The developer of this task did not add an example in the summary documentation.


GacUtil

Description

MSBuild task to install and uninstall assemblies into the GAC

Example

Install a dll into the GAC.

  <GacUtil 
                Command="Install" 
                Assemblies="MSBuild.Community.Tasks.dll" 
                Force="true" />

JSCompress (JavaScript.JSCompress)

Description

Compresses JavaScript source by removing comments and unnecessary whitespace. It typically reduces the size of the script by half, resulting in faster downloads and code that is harder to read.

No example given

The developer of this task did not add an example in the summary documentation.


AddTnsName (Oracle.AddTnsName)

Description

Defines a database host within the Oracle TNSNAMES.ORA file.

Example

Add an entry to the system default TNSNAMES.ORA file and update any entry that already exists:


TnsEntry (Oracle.TnsEntry)

Description

Contains information about a TNS definition

No example given

The developer of this task did not add an example in the summary documentation.


TnsParser (Oracle.TnsParser)

Description

Locates host entries within a TNSNAMES.ORA file

No example given

The developer of this task did not add an example in the summary documentation.


RoboCopy

Description

Task wrapping the Window Resource Kit Robocopy.exe command.

Example

Deploy website to web server.

  <RoboCopy 
            SourceFolder="$(MSBuildProjectDirectory)" 
            DestinationFolder="\\server\webroot\" 
            Mirror="true"
            ExcludeFolders=".svn;obj;Test"
            ExcludeFiles="*.cs;*.resx;*.csproj;*.webinfo;*.log"
            NoJobHeader="true"
        />  

Sound

Description

A task to play a sound from a .wav file path or URL.

Example

To play the windows XP startup sound, use

  <Sound SystemSoundFile="..\Media\Windows XP Startup.wav" />

FileBase (SourceServer.FileBase)

Description

A base class that has a file.

No example given

The developer of this task did not add an example in the summary documentation.


PdbStrCommands (SourceServer.PdbStrCommands)

Description

Commands for the tasks.

No example given

The developer of this task did not add an example in the summary documentation.


PdbStr (SourceServer.PdbStr)

Description

A task for the pdbstr from source server.

No example given

The developer of this task did not add an example in the summary documentation.


SourceFile (SourceServer.SourceFile)

Description

A class representing a source file.

No example given

The developer of this task did not add an example in the summary documentation.


SourceIndexBase (SourceServer.SourceIndexBase)

Description

A base class for source indexing a pdb symbol file.

No example given

The developer of this task did not add an example in the summary documentation.


SrcTool (SourceServer.SrcTool)

Description

A task for the srctool from source server.

No example given

The developer of this task did not add an example in the summary documentation.


SvnSourceIndex (SourceServer.SvnSourceIndex)

Description

A subversion source index task.

No example given

The developer of this task did not add an example in the summary documentation.


SymbolFile (SourceServer.SymbolFile)

Description

A class representing a symbol file.

No example given

The developer of this task did not add an example in the summary documentation.


TfsSourceIndex (SourceServer.TfsSourceIndex)

Description

Task to index pdb files and entries to retrieve source files from Team Foundation Server source control.

Example

Index a PDB.

  <TfsSourceIndex SymbolFiles="@(Symbols)" TeamProjectCollectionUri="http://my-tfsserver/tfs/DefaultCollection" />

SqlPubCommands (SqlServer.SqlPubCommands)

Description

The SqlPubWiz commands

No example given

The developer of this task did not add an example in the summary documentation.


SqlPubWiz (SqlServer.SqlPubWiz)

Description

The Database Publishing Wizard enables the deployment of SQL Server databases (both schema and data) into a shared hosting environment.

Example

Generate the database script for Northwind on localhost.

  <SqlPubWiz 
            Database="Northwind" 
            Output="Northwind.sql" 
            SchemaOnly="true" />

SvnCopy (Subversion.SvnCopy)

Description

Copy a file or folder in Subversion

Example

Create a tag of the trunk with the current Cruise Control build number:

  <Target Name="TagTheBuild">
  <SvnCopy SourcePath="file:///d:/svn/repo/Test/trunk"
                   DestinationPath="file:///d:/svn/repo/Test/tags/BUILD-$(CCNetLabel)" 
                   Message="Automatic build of $(CCNetProject)" />      
  </Target>

SvnClient (Subversion.SvnClient)

Description

Subversion client base class

No example given

The developer of this task did not add an example in the summary documentation.


Info (Subversion.Info)

Description

No example given

The developer of this task did not add an example in the summary documentation.


Entry (Subversion.Entry)

Description

No example given

The developer of this task did not add an example in the summary documentation.


EntryCollection (Subversion.EntryCollection)

Description

No example given

The developer of this task did not add an example in the summary documentation.


Repository (Subversion.Repository)

Description

No example given

The developer of this task did not add an example in the summary documentation.


WorkingCopy (Subversion.WorkingCopy)

Description

No example given

The developer of this task did not add an example in the summary documentation.


LastCommit (Subversion.LastCommit)

Description

No example given

The developer of this task did not add an example in the summary documentation.


SvnStatus (Subversion.SvnStatus)

Description

Subversion status command.

No example given

The developer of this task did not add an example in the summary documentation.


SymStoreCommands (SymbolServer.SymStoreCommands)

Description

Commands for the SymStore tasks.

No example given

The developer of this task did not add an example in the summary documentation.


SymStore (SymbolServer.SymStore)

Description

Task that wraps the Symbol Server SymStore.exe application.

No example given

The developer of this task did not add an example in the summary documentation.


InfoCommandResponse (Tfs.InfoCommandResponse)

Description

Represents the response from a tf.exe info command

No example given

The developer of this task did not add an example in the summary documentation.


ServerInformation (Tfs.ServerInformation)

Description

Represents the server information section created by a tf.exe info command

No example given

The developer of this task did not add an example in the summary documentation.


LocalInformation (Tfs.LocalInformation)

Description

Represents the local information section from a tf.exe info command

No example given

The developer of this task did not add an example in the summary documentation.


TfsClient (Tfs.TfsClient)

Description

A task for Team Foundation Server version control.

No example given

The developer of this task did not add an example in the summary documentation.


IRegistry (Services.IRegistry)

Description

The contract for a service that will provide access to the registry.

No example given

The developer of this task did not add an example in the summary documentation.


Win32Registry (Services.Win32Registry)

Description

Provides access to the Windows registry.

No example given

The developer of this task did not add an example in the summary documentation.


User

Description

Provides information about the build user.

Example

Get build user information.

  <User>
  <Output TaskParameter="UserNameWithDomain" PropertyName="BuildUserID" />
  <Output TaskParameter="FullName" PropertyName="BuildUserName" />
  <Output TaskParameter="Email" PropertyName="BuildUserEmail" />
  <Output TaskParameter="Phone" PropertyName="BuildUserPhone" />
  </User>    

WebUpload

Description

Upload a local file to a remote URI.

Example

Upload the xml file.

  <WebUpload RemoteUri="http://intranet/upload" FileName="page.xml" />

XmlMassUpdate (Xml.XmlMassUpdate)

Description

Performs multiple updates on an XML file

Example

These examples will demonstrate how to make multiple updates to a XML file named web.config. It looks like:

  <?xml version="1.0" encoding="utf-8" ?>

WebDirectoryScriptMap (IIS.WebDirectoryScriptMap)

Description

Sets an application mapping for a filename extension on an existing web directory.

Example

Map the .axd extension to the lastest version of ASP.NET:

  <WebDirectoryScriptMap VirtualDirectoryName="MyWeb" Extension=".axd" MapToAspNet="True" VerifyFileExists="False" />

WebBase (IIS.WebBase)

Description

Base task for any IIS-related task.

No example given

The developer of this task did not add an example in the summary documentation.


IISVersion (IIS.WebBase.IISVersion)

Description

Defines the possible IIS versions supported by the task.

No example given

The developer of this task did not add an example in the summary documentation.


ApplicationPoolAction (IIS.WebBase.ApplicationPoolAction)

Description

Defines the possible application pool actions to be performed.

No example given

The developer of this task did not add an example in the summary documentation.


IIS7ApplicationPoolState (IIS.WebBase.IIS7ApplicationPoolState)

Description

Defines the current application pool state.

No example given

The developer of this task did not add an example in the summary documentation.


WebDirectorySetting (IIS.WebDirectorySetting)

Description

Reads and modifies a web directory configuration setting.

Example

Display the file system path of the MyWeb web directory:

  <WebDirectorySetting VirtualDirectoryName="MyWeb" SettingName="Path">
  <Output TaskParameter="SettingValue" PropertyName="LocalPath" />
  </WebDirectorySetting>
  <Message Text="MyWeb is located at $(LocalPath)" />

ILMerge

Description

A wrapper for the ILMerge tool.

Example

This example merges two assemblies A.dll and B.dll into one:

  <PropertyGroup>
  <outputFile>$(testDir)\ilmergetest.dll</outputFile>
  <keyFile>$(testDir)\keypair.snk</keyFile>
  <excludeFile>$(testDir)\ExcludeTypes.txt</excludeFile>
  <logFile>$(testDir)\ilmergetest.log</logFile>
  </PropertyGroup>
  <ItemGroup>
  <inputAssemblies Include="$(testDir)\A.dll" />
  <inputAssemblies Include="$(testDir)\B.dll" />
  <allowDuplicates Include="ClassAB" />
  </ItemGroup>
  <Target Name="merge" >
   <ILMerge InputAssemblies="@(inputAssemblies)" 
               AllowDuplicateTypes="@(allowDuplicates)"
               ExcludeFile="$(excludeFile)"
               OutputFile="$(outputFile)" LogFile="$(logFile)"
               DebugInfo="true" XmlDocumentation="true" 
               KeyFile="$(keyFile)" DelaySign="true" />
  </Target>

InstallAssembly (Install.InstallAssembly)

Description

Installs assemblies.

Example

Install multiple assemblies by specifying the file names:


UninstallAssembly (Install.UninstallAssembly)

Description

Uninstalls assemblies.

Example

Uninstall multiple assemblies by specifying the file names:

  <UninstallAssembly AssemblyFiles="Engine.dll;Presenter.dll" />

Modulo (Math.Modulo)

Description

Performs the modulo operation on numbers.

Example

Numbers evenly divide:

<Math.Modulo Numbers="12;4"> </Math.Modulo> Above example will display: 12 modulo 4 = 0


MathBase (Math.MathBase)

Description

Math task base class

No example given

The developer of this task did not add an example in the summary documentation.


Prompt

Description

Displays a message on the console and waits for user input.

Example

Pause the build if the interactive property is set:

  <!-- Pause when invoked with the interactive property: msbuild myproject.proj /property:interactive=true -->
        
  <Prompt Text="You can now attach the debugger to the msbuild.exe process..." Condition="'$(Interactive)' == 'True'" />

RegexBase

Description

Base class for Regex tasks Handles public properties for Input, Expression, Options and Output

No example given

The developer of this task did not add an example in the summary documentation.


RegexMatch

Description

Task to filter an Input list with a Regex expression. Output list contains items from Input list that matched given expression

Example

Matches from TestGroup those names ending in a, b or c

  <ItemGroup>
   <TestGroup Include="foo.my.foo.foo.test.o" />
   <TestGroup Include="foo.my.faa.foo.test.a" />
   <TestGroup Include="foo.my.fbb.foo.test.b" />
   <TestGroup Include="foo.my.fcc.foo.test.c" />
   <TestGroup Include="foo.my.fdd.foo.test.d" />
   <TestGroup Include="foo.my.fee.foo.test.e" />
   <TestGroup Include="foo.my.fff.foo.test.f" />
  </ItemGroup>
  <Target Name="Test">
   <!-- Outputs only items that end with a, b or c -->
   <RegexMatch Input="@(TestGroup)" Expression="[a-c]$">
  <Output ItemName ="MatchReturn" TaskParameter="Output" />
   </RegexMatch>
   <Message Text="&#xA;Output Match:&#xA;@(MatchReturn, '&#xA;')" />
  </Target>

RegexReplace

Description

Task to replace portions of strings within the Input list Output list contains all the elements of the Input list after performing the Regex Replace.

Example

1st example replaces first occurance of "foo." with empty string 2nd example replaces occurance of "foo." after character 6 with "oop." string

  <ItemGroup>
   <TestGroup Include="foo.my.foo.foo.test.o" />
   <TestGroup Include="foo.my.faa.foo.test.a" />
   <TestGroup Include="foo.my.fbb.foo.test.b" />
   <TestGroup Include="foo.my.fcc.foo.test.c" />
   <TestGroup Include="foo.my.fdd.foo.test.d" />
   <TestGroup Include="foo.my.fee.foo.test.e" />
   <TestGroup Include="foo.my.fff.foo.test.f" />
  </ItemGroup>
  <Target Name="Test">
   <Message Text="Input:&#xA;@(TestGroup, '&#xA;')"/>
   <!-- Replaces first occurance of "foo." with empty string-->
   <RegexReplace Input="@(TestGroup)" Expression="foo\." Replacement="" Count="1">
  <Output ItemName ="ReplaceReturn1" TaskParameter="Output" />
   </RegexReplace>
   <Message Text="&#xA;Output Replace 1:&#xA;@(ReplaceReturn1, '&#xA;')" />
   <!-- Replaces occurance of "foo." after character 6 with "oop." string-->
   <RegexReplace Input="@(TestGroup)" Expression="foo\." Replacement="oop" Startat="6">
  <Output ItemName ="ReplaceReturn2" TaskParameter="Output" />
   </RegexReplace>
   <Message Text="&#xA;Output Replace 2:&#xA;@(ReplaceReturn2, '&#xA;')" />
  </Target>

TaskListAssemblyFormatType (Schema.TaskListAssemblyFormatType)

Description

Different ways to specify the assembly in a UsingTask element.

No example given

The developer of this task did not add an example in the summary documentation.


TaskSchema (Schema.TaskSchema)

Description

A Task that generates a XSD schema of the tasks in an assembly.

Example

Creates schema for MSBuild Community Task project

  <TaskSchema Assemblies="Build\MSBuild.Community.Tasks.dll" 
            OutputPath="Build" 
            CreateTaskList="true" 
            IgnoreMsBuildSchema="true"
            Includes="Microsoft.Build.Commontypes.xsd"/>

GetSolutionProjects

Description

Retrieves the list of Projects contained within a Visual Studio Solution (.sln) file

Example

Returns project name, GUID, and path information from test solution

  <Target Name="Test">
  <GetSolutionProjects Solution="TestSolution.sln">
  <Output ItemName="ProjectFiles" TaskParameter="Output"/>
  </GetSolutionProjects>
        
  <Message Text="Project names:" />
  <Message Text="%(ProjectFiles.ProjectName)" />
  <Message Text="Relative project paths:" />
  <Message Text="%(ProjectFiles.ProjectPath)" />
  <Message Text="Project GUIDs:" />
  <Message Text="%(ProjectFiles.ProjectGUID)" />
  <Message Text="Full paths to project files:" />
  <Message Text="%(ProjectFiles.FullPath)" />
  </Target>

ExecuteDDL (SqlServer.ExecuteDDL)

Description

MSBuild task to execute DDL and SQL statements.

Example

   <PropertyGroup>
        		<ConnectionString>Server=localhost;Integrated Security=True</ConnectionString>
        	</PropertyGroup>
        
   <Target Name="ExecuteDDL">
        		<ExecuteDDL ConnectionString="$(ConnectionString)" Files="SqlBatchScript.sql" ContinueOnError="false" />
   </Target>

NodeKind (Subversion.NodeKind)

Description

The kind of Subversion node. The names match the text output by "svn info".

No example given

The developer of this task did not add an example in the summary documentation.


Schedule (Subversion.Schedule)

Description

The Subversion schedule type.

No example given

The developer of this task did not add an example in the summary documentation.


SvnInfo (Subversion.SvnInfo)

Description

Run the "svn info" command and parse the output

Example

This example will determine the Subversion repository root for a working directory and print it out.

  <Target Name="printinfo">
  <SvnInfo LocalPath="c:\code\myapp">
  <Output TaskParameter="RepositoryRoot" PropertyName="root" />
  </SvnInfo>
  <Message Text="root: $(root)" />
  </Target>

TemplateFile

Description

MSBuild task that replaces tokens in a template file and writes out a new file.

Example

  <ItemGroup>
        	<Tokens Include="Name">
        		<ReplacementValue>MSBuild Community Tasks</ReplacementValue>
        	</Tokens>
  </ItemGroup>
        
  <TemplateFile Template="ATemplateFile.template" TemplateEncoding="Windows-1251" OutputFilename="ReplacedFile.txt" OutputEncoding="UTF-16" Tokens="@(Tokens)" />

Time

Description

Gets the current date and time.

Example

Using the Time task to get the Month, Day, Year, Hour, Minute, and Second:

  <Time>
  <Output TaskParameter="Month" PropertyName="Month" />
  <Output TaskParameter="Day" PropertyName="Day" />
  <Output TaskParameter="Year" PropertyName="Year" />
  <Output TaskParameter="Hour" PropertyName="Hour" />
  <Output TaskParameter="Minute" PropertyName="Minute" />
  <Output TaskParameter="Second" PropertyName="Second" />
  </Time>
  <Message Text="Current Date and Time: $(Month)/$(Day)/$(Year) $(Hour):$(Minute):$(Second)" />

Set property "BuildDate" to the current date and time:

  <Time Format="yyyyMMddHHmmss">
  <Output TaskParameter="FormattedTime" PropertyName="buildDate" />
  </Time>

XmlNodeTaskItem (Xml.XmlNodeTaskItem)

Description

Represents a single XmlNode selected using an XML task.

No example given

The developer of this task did not add an example in the summary documentation.


XmlQuery (Xml.XmlQuery)

Description

Reads a value or values from lines of XML

Example

Read an attribute value by selecting it with an XPath expression:


XmlTaskHelper (Xml.XmlTaskHelper)

Description

Provides methods used by all of the XML tasks

No example given

The developer of this task did not add an example in the summary documentation.


Xslt

Description

A task to merge and transform a set of xml files.

Example

This example for generating a report from a set of NUnit xml results:

$(project) $(configuration) $(MSBuildProjectFullPath) $(MSBuildBinPath) $(MSBuildCommunityTasksPath)\$(nunitReportXsl) This examples shows all available task attributes:


FileUpdate

Description

Replace text in file(s) using a Regular Expression.

Example

Search for a version number and update the revision.

  <FileUpdate Files="version.txt"
            Regex="(\d+)\.(\d+)\.(\d+)\.(\d+)"
            ReplacementText="$1.$2.$3.123" />

FxCop

Description

Uses FxCop to analyse managed code assemblies and reports on their design best-practice compliance.

Example

Shows how to analyse an assembly and use an XSLT stylesheet to present the report as an HTML file. If the static anlysis fails, the build does not stop - this is controlled with the FailOnError parameter.

  <FxCop 
          TargetAssemblies="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll"
          RuleLibraries="@(FxCopRuleAssemblies)" 
          Rules="Microsoft.Design#CA1012;-Microsoft.Performance#CA1805"
          AnalysisReportFileName="Test.html"
          DependencyDirectories="$(MSBuildCommunityTasksPath)"
          FailOnError="False"
          ApplyOutXsl="True"
          OutputXslFileName="C:\Program Files\Microsoft FxCop 1.32\Xml\FxCopReport.xsl"
        />

ServiceActions

Description

Defines the actions that can be performed on a service.

No example given

The developer of this task did not add an example in the summary documentation.


ServiceController

Description

Task that can control a Windows service.

Example

Restart Web Server

  <ServiceController ServiceName="w3svc" Action="Restart" />

ServiceQuery

Description

Task that can determine the status of a specified service on a target server.

Example

Check status of SQL Server

  <ServiceQuery ServiceName="MSSQLServer">
  <Output TaskParameter="Status" PropertyName="ResultStatus" />
  </ServiceQuery>
  <Message Text="MSSQLServer Service Status: $(ResultStatus)"/>

AppPoolCreate (IIS.AppPoolCreate)

Description

Creates a new application pool on a local or remote machine with IIS installed. The default is to create the new application pool on the local machine. If connecting to a remote machine, you can specify the and for the task to run under.

Example

Create a new application pool on the local machine.

  <AppPoolCreate AppPoolName="MyAppPool" />

WebDirectoryCreate (IIS.WebDirectoryCreate)

Description

Creates a new web directory on a local or remote machine with IIS installed. The default is to create the new web directory on the local machine. The physical path is required to already exist on the target machine. If connecting to a remote machine, you can specify the and for the task to run under.

Example

Create a new web directory on the local machine.

  <WebDirectoryCreate VirtualDirectoryName="MyVirDir"
            VirtualDirectoryPhysicalPath="C:\Inetpub\MyWebDir" />

AppPoolDelete (IIS.AppPoolDelete)

Description

Deletes an existing application pool on a local or remote machine with IIS installed. The default is to delete an existing application pool on the local machine. If connecting to a remote machine, you can specify the and for the task to run under.

Example

Delete an existing application pool on the local machine.

  <AppPoolDelete AppPoolName="MyAppPool" />

WebDirectoryDelete (IIS.WebDirectoryDelete)

Description

Deletes a web directory on a local or remote machine with IIS installed. The default is to delete the web directory on the local machine. If connecting to a remote machine, you can specify the and for the task to run under.

Example

Deletes a web directory on the local machine.

  <WebDirectoryDelete VirtualDirectoryName="MyVirDir" />

AppPoolControllerActions (IIS.AppPoolControllerActions)

Description

Actions the can do.

No example given

The developer of this task did not add an example in the summary documentation.


AppPoolController (IIS.AppPoolController)

Description

Allows control for an application pool on a local or remote machine with IIS installed. The default is to control the application pool on the local machine. If connecting to a remote machine, you can specify the and for the task to run under.

Example

Restart an application pool on the local machine.

  <AppPoolController AppPoolName="MyAppPool" Action="Restart" />

Mail

Description

Sends an email message

Example

Example of sending an email.

  <Target Name="Mail">
  <Mail SmtpServer="localhost"
                To="user@email.com"
                From="from@email.com"
                Subject="Test Mail Task"
                Body="This is a test of the mail task." />
  </Target>

Add (Math.Add)

Description

Add numbers

Example

Adding numbers:

  <Math.Add Numbers="4;3">
  <Output TaskParameter="Result" PropertyName="Result" />
  </Math.Add>
  <Message Text="Add 4+3= $(Result)"/>

Divide (Math.Divide)

Description

Divide numbers

Example

<Math.Divide Numbers="1;2"> </Math.Divide> Above example will display: Divide 1/2= 0.5


Multiple (Math.Multiple)

Description

Multiple numbers

Example

  <Math.Multiple Numbers="10;3">
  <Output TaskParameter="Result" PropertyName="Result" />
  </Math.Multiple>
  <Message Text="Multiple 10*3= $(Result)"/>

Subtract (Math.Subtract)

Description

Subtract numbers

Example

  <Math.Subtract Numbers="10;3">
  <Output TaskParameter="Result" PropertyName="Result" />
  </Math.Subtract>
  <Message Text="Subtract 10-3= $(Result)"/>

MV

Description

Moves files on the filesystem to a new location.

Example

Move a file to another folder

  <MV SourceFiles="Test\MoveMe.txt"
            DestinationFolder="Test\Move" />

Rename a file

  <MV SourceFiles="Test\Move\MoveMe.txt"
            DestinationFiles="Test\Move\Renamed.txt" />

NDoc

Description

Runs the NDoc application.

Example

Generated html help file.

  <NDoc Documenter="MSDN" 
            ProjectFilePath="MSBuild.Community.Tasks.ndoc" />

NUnit

Description

Run NUnit 2.4 on a group of assemblies.

Example

Run NUnit tests.

  <ItemGroup>
  <TestAssembly Include="C:\Program Files\NUnit 2.4\bin\*.tests.dll" />
  </ItemGroup>
  <Target Name="NUnit">
  <NUnit Assemblies="@(TestAssembly)" />
  </Target>

NUnit3

Description

Run NUnit 3.x on a group of assemblies.

Example

Run NUnit3 tests.

  <CreateItem Include="*\bin\Debug\*.*.UnitTests.dll">
     <Output TaskParameter="Include" ItemName="TestAssemblies"/>
  </CreateItem>
  <Target Name="NUnit3">
  <!-- Run NUnit passing in the list of assemblies built above -->		
  <NUnit3 Assemblies="@(TestAssemblies)" 
          Process="Multiple" 
		  TestTimeout="2000" 
          Framework="v4.0" 
		  Force32Bit="true" 
		  Workers="10" 
		  EnableShadowCopy="true" 
		  OutputXmlFile="myTestOutput.xml"
		  WorkingDirectory="./"
		  ShowLabels="All"
		  NoHeader="true"
		  NoColor="true"
		  Verbose="true"/>
  </Target>

Resources (Properties.Resources)

Description

一个强类型的资源类,用于查找本地化的字符串等。

No example given

The developer of this task did not add an example in the summary documentation.


RegistryRead

Description

Reads a value from the Registry

Example

Read .NET Framework install root from Registry.

  <RegistryRead 
            KeyName="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework" 
            ValueName="InstallRoot">
  <Output TaskParameter="Value" PropertyName="InstallRoot" />
  </RegistryRead>
  <Message Text="InstallRoot: $(InstallRoot)"/>

RegistryWrite

Description

Writes a value to the Registry

Example

Write a value to Registry

  <RegistryWrite 
            KeyName="HKEY_CURRENT_USER\SOFTWARE\MSBuildTasks"
            ValueName="RegistryWrite"
            Value="Test Write" />

Script

Description

Executes code contained within the task.

Example

Simple script that writes to the console

<Script Language="C#" Code="$(HelloCode)" Imports="System" />

Sleep

Description

A task for sleeping for a specified period of time.

Example

Causes the build to sleep for 300 milliseconds.

  <Sleep Milliseconds="300" />

SqlExecute

Description

Executes a SQL command.

Example

Example of returning a count of items in a table. Uses the default SelectMode of NonQuery.

  <SqlExecute ConnectionString="server=MyServer;Database=MyDatabase;Trusted_Connection=yes;"
                Command="create database MyDatabase" />

Example of returning the items of a table in an xml format.

  <SqlExecute ConnectionString="server=MyServer;Database=MyDatabase;Trusted_Connection=yes;"
        		Command="select * from SomeTable for xml auto"
        		SelectMode="ScalarXml"
        		OutputFile="SomeTable.xml" />

SvnCheckout (Subversion.SvnCheckout)

Description

Checkout a local working copy of a Subversion repository.

Example

Checkout a working copy

  <Target Name="Checkout">
  <RemoveDir Directories="$(MSBuildProjectDirectory)\Test\Checkout" />
  <SvnCheckout RepositoryPath="file:///d:/svn/repo/Test/trunk" 
                       LocalPath="$(MSBuildProjectDirectory)\Test\Checkout">      
  <Output TaskParameter="Revision" PropertyName="Revision" />
  </SvnCheckout>
  <Message Text="Revision: $(Revision)"/>
  </Target>

SvnCommit (Subversion.SvnCommit)

Description

Subversion Commit command

No example given

The developer of this task did not add an example in the summary documentation.


SvnExport (Subversion.SvnExport)

Description

Export a folder from a Subversion repository

Example

Export from repository

  <Target Name="Export">
  <MakeDir Directories="$(MSBuildProjectDirectory)\Test" />
  <RemoveDir Directories="$(MSBuildProjectDirectory)\Test\Export" />
  <SvnExport RepositoryPath="file:///d:/svn/repo/Test/trunk" 
            LocalPath="$(MSBuildProjectDirectory)\Test\Export">
  <Output TaskParameter="Revision" PropertyName="Revision" />
  </SvnExport>
  <Message Text="Revision: $(Revision)"/>
  </Target>

SvnVersion (Subversion.SvnVersion)

Description

Summarize the local revision(s) of a working copy.

Example

The following example gets the revision of the current folder.

  <Target Name="Version">
  <SvnVersion LocalPath=".">
  <Output TaskParameter="Revision" PropertyName="Revision" />
  </SvnVersion>
  <Message Text="Revision: $(Revision)"/>
  </Target>

SvnUpdate (Subversion.SvnUpdate)

Description

Subversion Update command

No example given

The developer of this task did not add an example in the summary documentation.


Unzip

Description

Unzip a file to a target directory.

Example

Unzip file tasks

  <Unzip ZipFileName="MSBuild.Community.Tasks.zip" 
            TargetDirectory="Backup"/>

Version

Description

Generates version information based on various algorithms

Example

Get version information from file and increment revision.

  <Version VersionFile="number.txt" BuildType="Automatic" RevisionType="Increment">
  <Output TaskParameter="Major" PropertyName="Major" />
  <Output TaskParameter="Minor" PropertyName="Minor" />
  <Output TaskParameter="Build" PropertyName="Build" />
  <Output TaskParameter="Revision" PropertyName="Revision" />
  </Version>
  <Message Text="Version: $(Major).$(Minor).$(Build).$(Revision)"/>

WebDownload

Description

Downloads a resource with the specified URI to a local file.

Example

Download the Microsoft.com home page.

  <WebDownload FileUri="http://www.microsoft.com/default.aspx" 
            FileName="microsoft.html" />

XmlRead

Description

Reads a value from a XML document using a XPath.

Example

Read all targest from a build project.

  <XmlRead Prefix="n"
            Namespace="http://schemas.microsoft.com/developer/msbuild/2003" 
            XPath="/n:Project/n:Target/@Name"
            XmlFileName="Subversion.proj">
  <Output TaskParameter="Value" PropertyName="BuildTargets" />
  </XmlRead>
  <Message Text="Build Targets: $(BuildTargets)"/>

XmlUpdate

Description

Updates a XML document using a XPath.

Example

Update a XML element.

  <XmlUpdate Prefix="n"
            Namespace="http://schemas.microsoft.com/developer/msbuild/2003" 
            XPath="/n:Project/n:PropertyGroup/n:TestUpdate"
            XmlFileName="Subversion.proj"
            Value="Test from $(MSBuildProjectFile)"/>

Zip

Description

Create a zip file with the files specified.

Example

Create a zip file

  <ItemGroup>
  <ZipFiles Include="**\*.*" Exclude="*.zip" />
  </ItemGroup>
  <Target Name="Zip">
  <Zip Files="@(ZipFiles)" 
                ZipFileName="MSBuild.Community.Tasks.zip" />
  </Target>

Create a zip file using a working directory.

  <ItemGroup>
  <RepoFiles Include="D:\svn\repo\**\*.*" />
  </ItemGroup>
  <Target Name="Zip">
  <Zip Files="@(RepoFiles)" 
                WorkingDirectory="D:\svn\repo" 
                ZipFileName="D:\svn\repo.zip" />
  </Target>