命令
# .NET Core v2
# Build, test, package, or publish a dotnet application, or run a custom dotnet command.
- task: DotNetCoreCLI@2
inputs:
command: 'build' # 'build' | 'push' | 'pack' | 'publish' | 'restore' | 'run' | 'test' | 'custom'. Required. Command. Default: build.
#publishWebProjects: true # boolean. Required when command = publish. Publish web projects. Default: true.
#projects: # string. Optional. Use when command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false. Path to project(s).
#custom: # string. Required when command = custom. Custom command.
#arguments: # string. Optional. Use when command = build || command = publish || command = run || command = test || command = custom. Arguments.
#restoreArguments: # string. Optional. Use when command = restore. Arguments.
#publishTestResults: true # boolean. Optional. Use when command = test. Publish test results and code coverage. Default: true.
#testRunTitle: # string. Optional. Use when command = test. Test run title.
#zipAfterPublish: true # boolean. Optional. Use when command = publish. Zip published projects. Default: true.
#modifyOutputPath: true # boolean. Optional. Use when command = publish. Add project's folder name to publish path. Default: true.
#packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg' # string. Alias: searchPatternPush. Required when command = push. Path to NuGet package(s) to publish. Default: $(Build.ArtifactStagingDirectory)/*.nupkg.
#nuGetFeedType: 'internal' # 'internal' | 'external'. Required when command = push. Target feed location. Default: internal.
#publishVstsFeed: # string. Alias: feedPublish. Required when command = push && nuGetFeedType = internal. Target feed.
#publishFeedCredentials: # string. Alias: externalEndpoint. Required when command = push && nuGetFeedType = external. NuGet server.
#packagesToPack: '**/*.csproj' # string. Alias: searchPatternPack. Required when command = pack. Path to csproj or nuspec file(s) to pack. Default: **/*.csproj.
#configuration: '$(BuildConfiguration)' # string. Alias: configurationToPack. Optional. Use when command = pack. Configuration to Package. Default: $(BuildConfiguration).
#packDirectory: '$(Build.ArtifactStagingDirectory)' # string. Alias: outputDir. Optional. Use when command = pack. Package Folder. Default: $(Build.ArtifactStagingDirectory).
#nobuild: false # boolean. Optional. Use when command = pack. Do not build. Default: false.
#includesymbols: false # boolean. Optional. Use when command = pack. Include Symbols. Default: false.
#includesource: false # boolean. Optional. Use when command = pack. Include Source. Default: false.
# Feeds and authentication
feedsToUse: 'select' # 'select' | 'config'. Alias: selectOrConfig. Required. Feeds to use. Default: select.
#vstsFeed: # string. Alias: feedRestore. Optional. Use when selectOrConfig = select. Use packages from this Azure Artifacts feed.
#includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig = select. Use packages from NuGet.org. Default: true.
#nugetConfigPath: # string. Optional. Use when selectOrConfig = config. Path to NuGet.config.
#externalFeedCredentials: # string. Alias: externalEndpoints. Optional. Use when selectOrConfig = config. Credentials for feeds outside this organization/collection.
# Advanced
#noCache: false # boolean. Disable local cache. Default: false.
#restoreDirectory: # string. Alias: packagesDirectory. Destination directory.
#verbosityRestore: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Verbosity. Default: Detailed.
# Advanced
#publishPackageMetadata: true # boolean. Optional. Use when command = push && nuGetFeedType = internal. Publish pipeline metadata. Default: true.
# Pack options
versioningScheme: 'off' # 'off' | 'byPrereleaseNumber' | 'byEnvVar' | 'byBuildNumber'. Required. Automatic package versioning. Default: off.
#versionEnvVar: # string. Required when versioningScheme = byEnvVar. Environment variable.
#majorVersion: '1' # string. Alias: requestedMajorVersion. Required when versioningScheme = byPrereleaseNumber. Major. Default: 1.
#minorVersion: '0' # string. Alias: requestedMinorVersion. Required when versioningScheme = byPrereleaseNumber. Minor. Default: 0.
#patchVersion: '0' # string. Alias: requestedPatchVersion. Required when versioningScheme = byPrereleaseNumber. Patch. Default: 0.
# Advanced
#buildProperties: # string. Additional build properties.
#verbosityPack: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Verbosity. Default: Detailed.
# Advanced
#workingDirectory: # string. Optional. Use when command != restore && command != push && command != pack. Working directory.
示例
- task: DotNetCoreCLI@2
displayName: 'Packing Core ...'
inputs:
command: 'pack'
packagesToPack: 'XXX/*.csproj'
versioningScheme: 'byPrereleaseNumber'
majorVersion: '1'
minorVersion: '0'
patchVersion: '0-preview'
verbosityPack: 'Minimal'
参考
https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2?view=azure-pipelines