共用方式為


VSBuild@1 - Visual Studio build v1 task

Use this task to build with MSBuild and set the Visual Studio version property. Learn more about installing Visual Studio images on Azure.

Inputs

solution - Solution
string. Required. Default value: **\*.sln.

Specifies the solution for the task to use in the build process.

If you want to build a single solution, click the ... button and specify the solution.

If you want to build multiple solutions, specify the search criteria. You can use a single-folder wildcard (*) and recursive wildcards (**). For example, **.sln searches for all .sln files in all subdirectories.

Make sure the solutions you specify are downloaded by this build pipeline. On the Repository tab:

  • If you use TFVC, make sure that the solution is a child of one of the mappings on the Repository tab.
  • If you use Git, make sure that the project or solution is in your Git repo, and in a branch that you're building.

Tip

  • You can also build MSBuild project (.*proj) files.
  • If you are building a customized MSBuild project file, we recommend you use the MSBuild task instead of the Visual Studio Build task.

vsVersion - Visual Studio Version
string. Allowed values: latest, 15.0 (Visual Studio 2017), 14.0 (Visual Studio 2015), 12.0 (Visual Studio 2013), 11.0 (Visual Studio 2012). Default value: latest.

The value of this input must match the version of Visual Studio used to create your solution.

Adds the /p:VisualStudioVersion={numeric_visual_studio_version} argument to the MSBuild command run by the build. For example, if you specify Visual Studio 2015, /p:VisualStudioVersion=14.0 is added to the MSBuild command.

Azure Pipelines: If your team wants to use Visual Studio with the Microsoft-hosted agents, select windows-latest as your default build pool. See Microsoft-hosted agents.


msbuildArgs - MSBuild Arguments
string.

Passes additional arguments to MSBuild. For syntax, see MSBuild Command-Line Reference.


platform - Platform
string.

Specifies the platform you want to build, such as Win32, x86, x64, or any cpu.

Tip

  • If you are targeting an MSBuild project (.*proj) file instead of a solution, specify AnyCPU (no whitespace).
  • Declare a build variable such as BuildPlatform on the Variables tab (selecting Allow at Queue Time) and reference it here as $(BuildPlatform). This way you can modify the platform when you queue the build and enable building multiple configurations.

configuration - Configuration
string.

Specifies the configuration you want to build, such as debug or release.

Tip

Declare a build variable such as BuildConfiguration on the Variables tab (selecting Allow at Queue Time) and reference it here as $(BuildConfiguration). This way you can modify the platform when you queue the build and enable building multiple configurations.


clean - Clean
boolean. Default value: false.

If set to false, the task makes an incremental build. This setting might reduce your build time, especially if your codebase is large. This option has no practical effect unless you also set the Clean repository to false.

If set to true, the task rebuilds all of the code in the code projects. This is equivalent to the MSBuild /target:clean argument.


maximumCpuCount - Build in Parallel
boolean. Default value: false.

Optional. If your MSBuild target configuration is compatible with building in parallel, you can check this input to pass the /m switch to MSBuild (Windows only). If your target configuration is not compatible with building in parallel, checking this option may cause your build to result in file-in-use errors, or intermittent or inconsistent build failures.


restoreNugetPackages - Restore NuGet Packages
boolean. Default value: false.

This input is deprecated. To restore NuGet packages, add a NuGet Tool Installer task before the build.


msbuildArchitecture - MSBuild Architecture
string. Allowed values: x86 (MSBuild x86), x64 (MSBuild x64). Default value: x86.

Optional. Supplies the architecture (x86 or x64) of MSBuild to run.

Tip

Because Visual Studio runs as a 32-bit application, you may experience problems when your build is processed by a build agent that is running the 64-bit version of Team Foundation Build Service. By selecting MSBuild x86, you may resolve these issues.


logProjectEvents - Record Project Details
boolean. Default value: true.

Optional. Records timeline details for each project.


createLogFile - Create Log File
boolean. Default value: false.

Optional. Creates a log file (Windows only).


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Learn more about installing Visual Studio images on Azure.

Important

This task is only supported on agents running Windows.

Requirements

Requirement Description
Pipeline types YAML, Classic build
Runs on Agent, DeploymentGroup
Demands Self-hosted agents must have capabilities that match the following demands to run jobs that use this task: msbuild, visualstudio
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 1.95.0 or greater
Task category Build