Επεξεργασία

Κοινή χρήση μέσω


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.

Syntax

# Visual Studio build v1
# Build with MSBuild and set the Visual Studio version property.
- task: VSBuild@1
  inputs:
    solution: '**\*.sln' # string. Required. Solution. Default: **\*.sln.
    #vsVersion: 'latest' # 'latest' | '17.0' | '16.0' | '15.0' | '14.0' | '12.0' | '11.0'. Visual Studio Version. Default: latest.
    #msbuildArgs: # string. MSBuild Arguments. 
    #platform: # string. Platform. 
    #configuration: # string. Configuration. 
    #clean: false # boolean. Clean. Default: false.
  # Advanced
    #maximumCpuCount: false # boolean. Build in Parallel. Default: false.
    #restoreNugetPackages: false # boolean. Restore NuGet Packages. Default: false.
    #msbuildArchitecture: 'x86' # 'x86' | 'x64'. MSBuild Architecture. Default: x86.
    #logProjectEvents: true # boolean. Record Project Details. Default: true.
    #createLogFile: false # boolean. Create Log File. Default: false.
    #logFileVerbosity: 'normal' # 'quiet' | 'minimal' | 'normal' | 'detailed' | 'diagnostic'. Optional. Use when createLogFile = true. Log File Verbosity. Default: normal.
    #enableDefaultLogger: true # boolean. Enable Default Logger. Default: true.
    #customVersion: # string. Custom Version.
# Visual Studio build v1
# Build with MSBuild and set the Visual Studio version property.
- task: VSBuild@1
  inputs:
    solution: '**\*.sln' # string. Required. Solution. Default: **\*.sln.
    #vsVersion: 'latest' # 'latest' | '16.0' | '15.0' | '14.0' | '12.0' | '11.0'. Visual Studio Version. Default: latest.
    #msbuildArgs: # string. MSBuild Arguments. 
    #platform: # string. Platform. 
    #configuration: # string. Configuration. 
    #clean: false # boolean. Clean. Default: false.
  # Advanced
    #maximumCpuCount: false # boolean. Build in Parallel. Default: false.
    #restoreNugetPackages: false # boolean. Restore NuGet Packages. Default: false.
    #msbuildArchitecture: 'x86' # 'x86' | 'x64'. MSBuild Architecture. Default: x86.
    #logProjectEvents: true # boolean. Record Project Details. Default: true.
    #createLogFile: false # boolean. Create Log File. Default: false.
    #logFileVerbosity: 'normal' # 'quiet' | 'minimal' | 'normal' | 'detailed' | 'diagnostic'. Optional. Use when createLogFile = true. Log File Verbosity. Default: normal.
# Visual Studio Build v1
# Build with MSBuild and set the Visual Studio version property.
- task: VSBuild@1
  inputs:
    solution: '**\*.sln' # string. Required. Solution. Default: **\*.sln.
    #vsVersion: 'latest' # 'latest' | '16.0' | '15.0' | '14.0' | '12.0' | '11.0'. Visual Studio Version. Default: latest.
    #msbuildArgs: # string. MSBuild Arguments. 
    #platform: # string. Platform. 
    #configuration: # string. Configuration. 
    #clean: false # boolean. Clean. Default: false.
  # Advanced
    #maximumCpuCount: false # boolean. Build in Parallel. Default: false.
    #restoreNugetPackages: false # boolean. Restore NuGet Packages. Default: false.
    #msbuildArchitecture: 'x86' # 'x86' | 'x64'. MSBuild Architecture. Default: x86.
    #logProjectEvents: true # boolean. Record Project Details. Default: true.
    #createLogFile: false # boolean. Create Log File. Default: false.

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, 17.0 (Visual Studio 2022), 16.0 (Visual Studio 2019), 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.


vsVersion - Visual Studio Version
string. Allowed values: latest, 16.0 (Visual Studio 2019), 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).


logFileVerbosity - Log File Verbosity
string. Optional. Use when createLogFile = true. Allowed values: quiet, minimal, normal, detailed, diagnostic. Default value: normal.

Specifies the verbosity level in log files.


enableDefaultLogger - Enable Default Logger
boolean. Default value: true.

If set to true, enables the default logger for MSBuild.


customVersion - Custom Version
string.

Sets a custom version of Visual Studio. Examples: 15.0, 16.0, 17.0. The required version of Visual Studio must be installed in the system.

Azure Pipelines: If your team wants to use Visual Studio 2022 with the Microsoft-hosted agents, select windows-2022 as your default build pool. For more info see Microsoft-hosted agents.


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