Muokkaa

Jaa


MSBuild task reference

Tasks provide the code that runs during the build process. The tasks in the following list are included with MSBuild. When the C++ workload is installed, additional tasks are available that are used to build C++ projects. For more information, see 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

Adds several parameters to the tasks that derive from the Task class. Not intended to be used directly.

Adds several parameters to the tasks that derive from the TaskExtension class. Not intended to be used directly.

Adds several parameters to the tasks that derive from the ToolTaskExtension class. Not intended to be used directly.

Creates an assembly with a manifest from one or more files that are either modules or resource files.

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

Assigns culture identifiers to items.

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

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

Invokes a target in the project file.

Combines the specified paths into a single path.

Converts a relative path or reference into an absolute path.

Copies files to a new location.

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

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

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

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

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

Deletes the specified files.

Downloads a file to the specified location.

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

Runs the specified program or command with the specified arguments.

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

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

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

Converts a URL to a correct URL format.

Appends the revision number to the version number.

Generates a ClickOnce application manifest or a native manifest.

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

Generates a ClickOnce deployment manifest.

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

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

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

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

Retrieves the path to the .NET Framework assemblies.

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

Returns the reference assembly paths of the various frameworks.

Generates a .license file from a .licx file.

Creates directories and, if necessary, any parent directories.

Logs a message during a build.

Moves files to a new location.

Builds MSBuild projects from another MSBuild project.

Reads a list of items from a text file.

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

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

Removes duplicate items from the specified item collection.

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.

Determines all assemblies that depend on the specified assemblies.

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

Determines the strong name key source

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

Resolves native references.

Determines the output files for non-MSBuild project references.

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

Signs the specified file using the specified certificate.

Sets the access and modification times of files.

Unregisters the specified assemblies for COM interop purposes.

Unzips a .zip archive to the specified location.

Updates selected properties in a manifest and resigns.

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

Verifies that a file matches the expected file hash.

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

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

Writes the specified items to the specified text file.

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

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

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

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

See also