MSBuild Task Reference

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

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.

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.

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..

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.

See Also

MSBuild Reference
Task Writing
Tasks