MSBuild task reference

Tasks provide the code that runs during the build process. The tasks in the following list are included with MSBuild. When Visual C++ is installed, additional tasks are available that are used to build Visual C++ projects. For more information, see Visual C++ tasks.

In addition to the parameters listed in the topics in this section, each task also has the following parameters:

Parameter Description
Condition Optional String parameter.

A Boolean expression that the MSBuild engine uses to determine whether this task will be executed. For information about the conditions that are supported by MSBuild, see Conditions.
ContinueOnError Optional parameter. Can contain one of the following values:

- WarnAndContinue or true. When a task fails, subsequent tasks in the Target element and the build continue to execute, and all errors from the task are treated as warnings.
- ErrorAndContinue. When a task fails, subsequent tasks in the Target element and the build continue to execute, and all errors from the task are treated as errors.
- ErrorAndStop or false (default). When a task fails, the remaining tasks in the Target element and the build aren't executed, and the entire Target element and the build is considered to have failed.

Versions of the .NET Framework before 4.5 supported only the true and false values.

For more information, see How to: Ignore errors in tasks.

In this section

Task base class
Adds several parameters to the tasks that derive from the Task class.

TaskExtension base class
Adds several parameters to the tasks that derive from the TaskExtension class.

ToolTaskExtension base class
Adds several parameters to the tasks that derive from the ToolTaskExtension class.

AL (Assembly Linker) task
Creates an assembly with a manifest from one or more files that are either modules or resource files.

AspNetCompiler task
Wraps aspnet_compiler.exe, a utility to precompile ASP.NET applications.

AssignCulture task
Assigns culture identifiers to items.

AssignProjectConfiguration task
Accepts a list of configuration strings and assigns them to specified projects.

AssignTargetPath task
Accepts a list of files and adds <TargetPath> attributes if they are not already specified.

CallTarget task
Invokes a target in the project file.

CombinePath task
Combines the specified paths into a single path.

ConvertToAbsolutePath task
Converts a relative path or reference into an absolute path.

Copy task
Copies files to a new location.

CreateCSharpManifestResourceName task
Creates a Visual C#-style manifest name from a given .resx file name or other resource.

CreateItem task
Populates item collections from the input items, allowing items to be copied from one list to another.

CreateProperty task
Populates properties from the input values, allowing values to be copied from one property or string to another.

CreateVisualBasicManifestResourceName task
Creates a Visual Basic-style manifest name from a given .resx file name or other resource.

Csc task
Invokes the Visual C# compiler to produce executables, dynamic-link libraries, or code modules.

Delete task
Deletes the specified files.

DownloadFile task
Downloads a file to the specified location.

Error task
Stops a build and logs an error based on an evaluated conditional statement.

Exec task
Runs the specified program or command with the specified arguments.

FindAppConfigFile task
Finds the app.config file, if any, in the provided lists.

FindInList task
Finds an item in a specified list that has the matching itemspec.

FindUnderPath task
Determines which items in the specified item collection exist in the specified folder and all of its subfolders.

FormatUrl task
Converts a URL to a correct URL format.

FormatVersion task
Appends the revision number to the version number.

GenerateApplicationManifest task
Generates a ClickOnce application manifest or a native manifest.

GenerateBootstrapper task
Provides an automated way to detect, download, and install an application and its prerequisites.

GenerateDeploymentManifest task
Generates a ClickOnce deployment manifest.

GenerateResource task
Converts .txt and .resx files to common language runtime binary .resources files.

GenerateTrustInfo task
Generates the application trust from the base manifest, and from the TargetZone and ExcludedPermissions parameters.

GetAssemblyIdentity task
Retrieves the assembly identities from the specified files and outputs the identity information.

GetFileHash task
Computes checksums of the contents of a file or set of files.

GetFrameworkPath task
Retrieves the path to the .NET Framework assemblies.

GetFrameworkSdkPath task
Retrieves the path to the Windows Software Development Kit (SDK).

GetReferenceAssemblyPaths task
Returns the reference assembly paths of the various frameworks.

LC task
Generates a .license file from a .licx file.

MakeDir task
Creates directories and, if necessary, any parent directories.

Message task
Logs a message during a build.

Move task
Moves files to a new location.

MSBuild task
Builds MSBuild projects from another MSBuild project.

ReadLinesFromFile task
Reads a list of items from a text file.

RegisterAssembly task
Reads the metadata within the specified assembly and adds the necessary entries to the registry.

RemoveDir task
Removes the specified directories and all of its files and subdirectories.

RemoveDuplicates task
Removes duplicate items from the specified item collection.

RequiresFramework35SP1Assembly task
Determines whether the application requires the .NET Framework 3.5 SP1.

ResGen Task
Obsolete. Use the GenerateResource task task to convert .txt and .resx files to and from common language runtime binary .resources files.

ResolveAssemblyReference task
Determines all assemblies that depend on the specified assemblies.

ResolveComReference task
Takes a list of one or more type library names or .tlb files and resolves those type libraries to locations on disk.

ResolveKeySource task
Determines the strong name key source

ResolveManifestFiles task
Resolves the following items in the build process to files for manifest generation: built items, dependencies, satellites, content, debug symbols, and documentation.

ResolveNativeReference task
Resolves native references.

ResolveNonMSBuildProjectOutput task
Determines the output files for non-MSBuild project references.

SGen task
Creates an XML serialization assembly for types in the specified assembly.

SignFile task
Signs the specified file using the specified certificate.

Touch task
Sets the access and modification times of files.

UnregisterAssembly task
Unregisters the specified assemblies for COM interop purposes.

Unzip task
Unzips a .zip archive to the specified location.

UpdateManifest task
Updates selected properties in a manifest and resigns.

Vbc task
Invokes the Visual Basic compiler to produce executables, dynamic-link libraries, or code modules..

VerifyFileHash task
Verifies that a file matches the expected file hash.

Warning task
Logs a warning during a build based on an evaluated conditional statement.

WriteCodeFragment task
Generates a temporary code file by using the specified generated code fragment. Does not delete the file.

WriteLinesToFile task
Writes the specified items to the specified text file.

XmlPeek task
Returns values as specified by XPath query from an XML file.

XmlPoke task
Sets values as specified by an XPath query into an XML file.

XslTransformation task
Transforms an XML input by using an Extensible Stylesheet Language Transformation (XSLT) or compiled XSLT and outputs to an output device or a file.

ZipDirectory task
Creates a .zip archive from the contents of a directory.

See also

MSBuild reference
Task writing