DotNetCoreCLI@2– .NET Core v2-Aufgabe

Hiermit wird eine .NET-Anwendung erstellt, getestet paketiert oder veröffentlicht oder ein benutzerdefinierter .NET-Befehl ausgeführt.

Hiermit wird eine .NET-Anwendung erstellt, getestet paketiert oder veröffentlicht oder ein benutzerdefinierter .NET-Befehl ausgeführt. Unterstützt für Paketbefehle NuGet.org und authentifizierte Feeds wie Paketverwaltung und MyGet.

Wichtig

Die Aufgabe NuGet-Authentifizierung ist die neue empfohlene Methode für die Authentifizierung bei Azure Artifacts und anderen NuGet-Repositorys. Die restore Befehle und push dieser .NET Core CLI-Aufgabe übernehmen keine neuen Features mehr, und es werden nur kritische Fehler behoben. Weitere Informationen finden Sie in den Anmerkungen.

Syntax

# .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. Optional. Use 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) or solution(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 when command = restore. Feeds to use. Default: select.
    #vstsFeed: # string. Alias: feedRestore. Optional. Use when selectOrConfig = select && command = restore. Use packages from this Azure Artifacts feed. 
    #includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig = select && command = restore. Use packages from NuGet.org. Default: true.
    #nugetConfigPath: # string. Optional. Use when selectOrConfig = config && command = restore. Path to NuGet.config. 
    #externalFeedCredentials: # string. Alias: externalEndpoints. Optional. Use when selectOrConfig = config && command = restore. Credentials for feeds outside this organization/collection. 
  # Advanced
    #noCache: false # boolean. Optional. Use when command = restore. Disable local cache. Default: false.
    #restoreDirectory: # string. Alias: packagesDirectory. Optional. Use when command = restore. Destination directory. 
    #verbosityRestore: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = restore. Verbosity. Default: Detailed.
  # Advanced
    #publishPackageMetadata: true # boolean. Optional. Use when command = push && nuGetFeedType = internal && command = push. Publish pipeline metadata. Default: true.
  # Pack options
    #versioningScheme: 'off' # 'off' | 'byPrereleaseNumber' | 'byEnvVar' | 'byBuildNumber'. Required when command = pack. Automatic package versioning. Default: off.
    #versionEnvVar: # string. Required when versioningScheme = byEnvVar && command = pack. Environment variable. 
    #majorVersion: '1' # string. Alias: requestedMajorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Major. Default: 1.
    #minorVersion: '0' # string. Alias: requestedMinorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Minor. Default: 0.
    #patchVersion: '0' # string. Alias: requestedPatchVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Patch. Default: 0.
  # Advanced
    #buildProperties: # string. Optional. Use when command = pack. Additional build properties. 
    #verbosityPack: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = pack. Verbosity. Default: Detailed.
  # Advanced
    #workingDirectory: # string. Optional. Use when command != restore && command != push && command != pack && command != pack && command != push && command != restore. Working directory.
# .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. Optional. Use 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 when command = restore. Feeds to use. Default: select.
    #vstsFeed: # string. Alias: feedRestore. Optional. Use when selectOrConfig = select && command = restore. Use packages from this Azure Artifacts feed. 
    #includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig = select && command = restore. Use packages from NuGet.org. Default: true.
    #nugetConfigPath: # string. Optional. Use when selectOrConfig = config && command = restore. Path to NuGet.config. 
    #externalFeedCredentials: # string. Alias: externalEndpoints. Optional. Use when selectOrConfig = config && command = restore. Credentials for feeds outside this organization/collection. 
  # Advanced
    #noCache: false # boolean. Optional. Use when command = restore. Disable local cache. Default: false.
    #restoreDirectory: # string. Alias: packagesDirectory. Optional. Use when command = restore. Destination directory. 
    #verbosityRestore: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = restore. Verbosity. Default: Detailed.
  # Advanced
    #publishPackageMetadata: true # boolean. Optional. Use when command = push && nuGetFeedType = internal && command = push. Publish pipeline metadata. Default: true.
  # Pack options
    #versioningScheme: 'off' # 'off' | 'byPrereleaseNumber' | 'byEnvVar' | 'byBuildNumber'. Required when command = pack. Automatic package versioning. Default: off.
    #versionEnvVar: # string. Required when versioningScheme = byEnvVar && command = pack. Environment variable. 
    #majorVersion: '1' # string. Alias: requestedMajorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Major. Default: 1.
    #minorVersion: '0' # string. Alias: requestedMinorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Minor. Default: 0.
    #patchVersion: '0' # string. Alias: requestedPatchVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Patch. Default: 0.
  # Advanced
    #buildProperties: # string. Optional. Use when command = pack. Additional build properties. 
    #verbosityPack: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = pack. Verbosity. Default: Detailed.
  # Advanced
    #workingDirectory: # string. Optional. Use when command != restore && command != push && command != pack && command != pack && command != push && command != restore. Working directory.
# .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. Optional. Use 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. 
    #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 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 when command = restore. Feeds to use. Default: select.
    #vstsFeed: # string. Alias: feedRestore. Optional. Use when selectOrConfig = select && command = restore. Use packages from this Azure Artifacts feed. 
    #includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig = select && command = restore. Use packages from NuGet.org. Default: true.
    #nugetConfigPath: # string. Optional. Use when selectOrConfig = config && command = restore. Path to NuGet.config. 
    #externalFeedCredentials: # string. Alias: externalEndpoints. Optional. Use when selectOrConfig = config && command = restore. Credentials for feeds outside this organization/collection. 
  # Advanced
    #noCache: false # boolean. Optional. Use when command = restore. Disable local cache. Default: false.
    #restoreDirectory: # string. Alias: packagesDirectory. Optional. Use when command = restore. Destination directory. 
    #verbosityRestore: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = restore. Verbosity. Default: Detailed.
  # Advanced
    #publishPackageMetadata: true # boolean. Optional. Use when command = push && nuGetFeedType = internal && command = push. Publish pipeline metadata. Default: true.
  # Pack options
    #versioningScheme: 'off' # 'off' | 'byPrereleaseNumber' | 'byEnvVar' | 'byBuildNumber'. Required when command = pack. Automatic package versioning. Default: off.
    #versionEnvVar: # string. Required when versioningScheme = byEnvVar && command = pack. Environment variable. 
    #majorVersion: '1' # string. Alias: requestedMajorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Major. Default: 1.
    #minorVersion: '0' # string. Alias: requestedMinorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Minor. Default: 0.
    #patchVersion: '0' # string. Alias: requestedPatchVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Patch. Default: 0.
  # Advanced
    #buildProperties: # string. Optional. Use when command = pack. Additional build properties. 
    #verbosityPack: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = pack. Verbosity. Default: Detailed.
  # Advanced
    #workingDirectory: # string. Optional. Use when command != pack && command != push && command != restore. Working Directory.
# .NET Core v2
# Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
- task: DotNetCoreCLI@2
  inputs:
    command: 'build' # 'build' | 'push' | 'pack' | 'publish' | 'restore' | 'run' | 'test' | 'custom'. Required. Command. Default: build.
    #publishWebProjects: true # boolean. Optional. Use 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. 
    #publishTestResults: true # boolean. Optional. Use when command = test. Publish test results and code coverage. Default: true.
    #zipAfterPublish: true # boolean. Optional. Use when command = publish. Zip Published Projects. Default: true.
    #modifyOutputPath: true # boolean. Optional. Use when command = publish. Add project 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.
  # Feeds and authentication
    #feedsToUse: 'select' # 'select' | 'config'. Alias: selectOrConfig. Required when command = restore. Feeds to use. Default: select.
    #vstsFeed: # string. Alias: feedRestore. Optional. Use when selectOrConfig = select && command = restore. Use packages from this Azure Artifacts/TFS feed. 
    #includeNuGetOrg: true # boolean. Optional. Use when selectOrConfig = select && command = restore. Use packages from NuGet.org. Default: true.
    #nugetConfigPath: # string. Optional. Use when selectOrConfig = config && command = restore. Path to NuGet.config. 
    #externalFeedCredentials: # string. Alias: externalEndpoints. Optional. Use when selectOrConfig = config && command = restore. Credentials for feeds outside this organization/collection. 
  # Advanced
    #noCache: false # boolean. Optional. Use when command = restore. Disable local cache. Default: false.
    #restoreDirectory: # string. Alias: packagesDirectory. Optional. Use when command = restore. Destination directory. 
    #verbosityRestore: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = restore. Verbosity. Default: Detailed.
  # Pack options
    #versioningScheme: 'off' # 'off' | 'byPrereleaseNumber' | 'byEnvVar' | 'byBuildNumber'. Required when command = pack. Automatic package versioning. Default: off.
    #versionEnvVar: # string. Required when versioningScheme = byEnvVar && command = pack. Environment variable. 
    #majorVersion: '1' # string. Alias: requestedMajorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Major. Default: 1.
    #minorVersion: '0' # string. Alias: requestedMinorVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Minor. Default: 0.
    #patchVersion: '0' # string. Alias: requestedPatchVersion. Required when versioningScheme = byPrereleaseNumber && command = pack. Patch. Default: 0.
  # Advanced
    #buildProperties: # string. Optional. Use when command = pack. Additional build properties. 
    #verbosityPack: 'Detailed' # '-' | 'Quiet' | 'Minimal' | 'Normal' | 'Detailed' | 'Diagnostic'. Optional. Use when command = pack. Verbosity. Default: Detailed.
  # Advanced
    #workingDirectory: # string. Optional. Use when command != pack && command != push && command != restore. Working Directory.
# YAML Syntax is not supported in TFS 2018.
# Use the classic designer to add and configure tasks.
# See the following Inputs section for details on the inputs that this task supports.

Eingaben

command - Befehl
string. Erforderlich. Zulässige Werte: build, push (Nuget-Push), pack, publish, restore, run, test, custom. Standardwert. build.

Der auszuführende .NET-Befehl. Geben Sie custom an, um Argumente hinzuzufügen, oder verwenden Sie einen Befehl, der hier nicht aufgeführt ist.

Wichtig

Die Aufgabe NuGet-Authentifizierung ist die neue empfohlene Methode für die Authentifizierung bei Azure Artifacts und anderen NuGet-Repositorys. Die restore Befehle und push dieser .NET Core CLI-Aufgabe übernehmen keine neuen Features mehr, und es werden nur kritische Fehler behoben. Weitere Informationen finden Sie in den Anmerkungen.


publishWebProjects - Veröffentlichen von Webprojekten
boolean. Optional. Verwenden Sie , wenn command = publish. Standardwert. true.

Wenn diese Eingabe auf truefestgelegt ist, wird der projects Eigenschaftswert übersprungen, und der Task versucht, die Webprojekte im Repository zu finden und den Befehl veröffentlichen für diese auszuführen. Webprojekte werden durch das Vorhandensein einer web.config Datei oder eines wwwroot Ordners im Verzeichnis identifiziert. Wenn keine web.config Datei oder ein wwwroot Ordner vorhanden ist, werden Projekte ausgewählt, die ein Web-SDK verwenden, z. B Microsoft.NET.Sdk.Web. .


publishWebProjects - Veröffentlichen von Webprojekten
boolean. Optional. Verwenden Sie , wenn command = publish. Standardwert. true.

Wenn diese Eingabe auf truefestgelegt ist, wird der projects Eigenschaftswert übersprungen, und der Task versucht, die Webprojekte im Repository zu finden und den Befehl veröffentlichen für diese auszuführen. Webprojekte werden durch das Vorhandensein einer web.config Datei oder eines wwwroot Ordners im Verzeichnis identifiziert. Wenn keine web.config Datei oder ein wwwroot Ordner vorhanden ist, werden Projekte ausgewählt, die ein Web-SDK verwenden, z. B Microsoft.NET.Sdk.Web. .


projects - Pfad zu Projekten oder Projektmappen
string. Optional. Verwenden Sie , wenn command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false.

Der Pfad zu den .csproj.sln zu verwendenden Oder-Dateien. Sie können Wildcards (z. B. **/*.csproj für alle .csproj Dateien in allen Unterordnern) verwenden. Weitere Informationen finden Sie in der Referenz zu Dateiabgleichsmustern.

Dieser Pfad ist relativ zum Stammverzeichnis des Repositorys, unabhängig von der workingDirectory Einstellung.


projects - Pfad zu Projekten
string. Optional. Verwenden Sie , wenn command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false.

Der Pfad zu den .csproj zu verwendenden Dateien. Sie können Wildcards (z. B. **/*.csproj für alle .csproj Dateien in allen Unterordnern) verwenden. Weitere Informationen finden Sie in der Referenz zu Dateiabgleichsmustern.

Dieser Pfad ist relativ zum Stammverzeichnis des Repositorys, unabhängig von der workingDirectory Einstellung.


custom - Benutzerdefinierter Befehl
string. Erforderlich, wenn command = custom.

Der Befehl, an den zur Ausführung übergeben werden dotnet.exe soll. Eine vollständige Liste der verfügbaren Befehle finden Sie in der Dokumentation zur dotnet CLI.


arguments - Argumente
string. Optional. Verwenden Sie , wenn command = build || command = publish || command = run || command = test || command = custom.

Gibt die Argumente für den ausgewählten Befehl an. Beispiel: Buildkonfiguration, Ausgabeordner und Runtime. Die Argumente hängen vom ausgewählten Befehl ab.

Diese Eingabe akzeptiert derzeit nur Argumente für build, publish, run, testund custom. Wenn Sie Argumente für einen Befehl hinzufügen möchten, der nicht aufgeführt ist, verwenden Sie custom.


restoreArguments - Argumente
string. Optional. Verwenden Sie , wenn command = restore.

Schreibt die zusätzlichen Argumente, die an den restore Befehl übergeben werden sollen.


publishTestResults - Veröffentlichen von Testergebnissen und Code coverage
boolean. Optional. Verwenden Sie , wenn command = test. Standardwert. true.

Wenn Sie diese Option aktivieren, wird eine test results TRX-Datei in $(Agent.TempDirectory)generiert, und die Ergebnisse werden auf dem Server veröffentlicht.

Mit dieser Option wird --logger trx --results-directory $(Agent.TempDirectory) an die Befehlszeilenargumente angefügt.

Die Codeabdeckung kann durch Hinzufügen der --collect "Code coverage" Option zu den Befehlszeilenargumenten erfasst werden.


publishTestResults - Veröffentlichen von Testergebnissen
boolean. Optional. Verwenden Sie , wenn command = test. Standardwert. true.

Wenn Sie diese Option aktivieren, wird eine test results TRX-Datei in $(Agent.TempDirectory)generiert, und die Ergebnisse werden auf dem Server veröffentlicht.

Diese Option fügt die --logger trx --results-directory $(Agent.TempDirectory) an die Befehlszeilenargumente an.

Die Codeabdeckung kann durch Hinzufügen der --collect "Code coverage" Option zu den Befehlszeilenargumenten erfasst werden.


testRunTitle - Titel der Testausführung
string. Optional. Verwenden Sie , wenn command = test.

Stellt einen Namen für die Testausführung bereit.


zipAfterPublish - Zip veröffentlichte Projekte
boolean. Optional. Verwenden Sie , wenn command = publish. Standardwert. true.

Wenn diese Eingabe auf truefestgelegt ist, werden ordner, die mit dem Befehl publish erstellt wurden, gezippt und gelöscht.


zipAfterPublish - Zip veröffentlichte Projekte
boolean. Optional. Verwenden Sie , wenn command = publish. Standardwert. true.

Wenn diese Eingabe auf truefestgelegt ist, wird der mit dem Befehl veröffentlichen erstellte Ordner gezippt und gelöscht.


modifyOutputPath - Hinzufügen des Ordnernamens des Projekts zum Veröffentlichungspfad
boolean. Optional. Verwenden Sie , wenn command = publish. Standardwert. true.

Wenn diese Eingabe auf truefestgelegt ist, wird den ordnern, die mit dem Befehl publish erstellt wurden, der Projektdateiname den Ordnernamen vorangestellt, wenn der Ausgabepfad explizit in Argumenten angegeben wird. Dies ist nützlich, wenn Sie mehrere Projekte im selben Ordner veröffentlichen möchten.


modifyOutputPath - Hinzufügen des Projektnamens zum Veröffentlichungspfad
boolean. Optional. Verwenden Sie , wenn command = publish. Standardwert. true.

Wenn diese Eingabe auf truefestgelegt ist, wird für Ordner, die vom Befehl publish erstellt wurden, der Projektdateiname ihren Ordnernamen vorangestellt, wenn der Ausgabepfad explizit in Argumenten angegeben wird. Dies ist nützlich, wenn Sie mehrere Projekte im selben Ordner veröffentlichen möchten.


feedsToUse - Zu verwendende Feeds
Eingabealias: selectOrConfig. string. Erforderlich, wenn command = restore. Zulässige Werte: select (Feed(s) Ich wähle hier aus), config (Feeds in meinem NuGet.config). Standardwert. select.

Sie können entweder einen Feed aus Azure Artifacts und/oder NuGet.org hier auswählen, oder Sie können eine nuget.config Datei in Ihr Quellcoderepository committen und ihren Pfad mithilfe der nugetConfigPath Eingabe festlegen.


vstsFeed - Verwenden von Paketen aus diesem Azure Artifacts-Feed
Eingabealias: feedRestore. string. Optional. Verwenden Sie , wenn selectOrConfig = select && command = restore.

Schließt den ausgewählten Feed in die generierte NuGet.configein. Sie müssen die Paketverwaltung installiert und lizenziert haben, um hier einen Feed auswählen zu können. projectName/feedName werden für projektbezogene Feeds verwendet. Wird nur FeedName für organization-Feeds verwendet. Hinweis: Dies wird für den Testbefehl nicht unterstützt.


vstsFeed - Verwenden von Paketen aus diesem Azure Artifacts/TFS-Feed
Eingabealias: feedRestore. string. Optional. Verwenden Sie , wenn selectOrConfig = select && command = restore.

Schließt den ausgewählten Feed in die generierte NuGet.configein. Sie müssen die Paketverwaltung installiert und lizenziert haben, um hier einen Feed auswählen zu können. projectName/feedName werden für projektbezogene Feeds verwendet. Wird nur FeedName für organization-Feeds verwendet. Hinweis: Dies wird für den Testbefehl nicht unterstützt.


vstsFeed - Verwenden von Paketen aus diesem VSTS/TFS-Feed
Eingabealias: feedRestore. string. Optional. Verwenden Sie , wenn selectOrConfig = select && command = restore.

Schließt den ausgewählten Feed in die generierte NuGet.configein. Sie müssen die Paketverwaltung installiert und lizenziert haben, um hier einen Feed auswählen zu können.


includeNuGetOrg - Verwenden von Paketen aus NuGet.org
boolean. Optional. Verwenden Sie , wenn selectOrConfig = select && command = restore. Standardwert. true.

Schließt NuGet.org in die generierte NuGet.configein.


nugetConfigPath - Pfad zu NuGet.config
string. Optional. Verwenden Sie , wenn selectOrConfig = config && command = restore.

Der NuGet.config in Ihrem Repository, der die Feeds angibt, aus denen Pakete wiederhergestellt werden sollen.


externalFeedCredentials - Anmeldeinformationen für Feeds außerhalb dieser organization/Sammlung
Eingabealias: externalEndpoints. string. Optional. Verwenden Sie , wenn selectOrConfig = config && command = restore.

Die Anmeldeinformationen, die für externe Registrierungen verwendet werden sollen, die sich im ausgewählten NuGet.configbefinden. Lassen Sie für Feeds in dieser organization/Sammlung diese Eingabe leer. Die Anmeldeinformationen des Builds werden automatisch verwendet.


externalFeedCredentials - Anmeldeinformationen für Feeds außerhalb dieses Kontos/dieser Sammlung
Eingabealias: externalEndpoints. string. Optional. Verwenden Sie , wenn selectOrConfig = config && command = restore.

Die Anmeldeinformationen, die für externe Registrierungen verwendet werden sollen, die sich im ausgewählten NuGet.configbefinden. Lassen Sie für Feeds in dieser organization/Sammlung diese Eingabe leer. Die Anmeldeinformationen des Builds werden automatisch verwendet.


noCache - Deaktivieren des lokalen Caches
boolean. Optional. Verwenden Sie , wenn command = restore. Standardwert. false.

Verhindert, dass NuGet Pakete aus dem Cache eines lokalen Computers verwendet.


restoreDirectory - Zielverzeichnis
Eingabealias: packagesDirectory. string. Optional. Verwenden Sie , wenn command = restore.

Gibt den Ordner an, in dem Pakete installiert sind. Wenn kein Ordner angegeben ist, werden Pakete im Standardmäßigen NuGet-Paketcache wiederhergestellt.


verbosityRestore - Ausführlichkeit
string. Optional. Verwenden Sie , wenn command = restore. Zulässige Werte: -, Quiet, Minimal, DetailedNormal, , . Diagnostic Standardwert. Detailed.

Gibt die Menge der Details an, die in der Ausgabe für den Befehl restore angezeigt werden.


packagesToPush - Pfad zu zu veröffentlichenden NuGet-Paketen
Eingabealias: searchPatternPush. string. Erforderlich, wenn command = push. Standardwert. $(Build.ArtifactStagingDirectory)/*.nupkg.

Das Muster, das oder der Pfad zu nupkg den hochzuladenden Dateien abgeglichen werden soll. Mehrere Muster können durch ein Semikolon getrennt werden, und Sie können ein Muster als negativ festlegen, indem Sie ihm das Präfix ! voranstellen. Beispiel: **/*.nupkg;!**/*.Tests.nupkg.


nuGetFeedType - Zielfeedspeicherort
string. Erforderlich, wenn command = push. Zulässige Werte: internal (Diese organization/Sammlung), external (externer NuGet-Server (einschließlich anderer Organisationen/Sammlungen)). Standardwert. internal.

Gibt an, ob der Zielfeed intern oder extern ist.


nuGetFeedType - Zielfeedspeicherort
string. Erforderlich, wenn command = push. Zulässige Werte: internal (Dieses Konto/diese Sammlung), external (Externer NuGet-Server (einschließlich anderer Konten/Sammlungen)). Standardwert. internal.

Gibt an, ob der Zielfeed intern oder extern ist.


publishVstsFeed - Zielfeed
Eingabealias: feedPublish. string. Erforderlich, wenn command = push && nuGetFeedType = internal.

Gibt einen In diesem organization gehosteten Feed an. Sie müssen die Paketverwaltung installiert und lizenziert haben, um hier einen Feed auswählen zu können.


publishPackageMetadata - Veröffentlichen von Pipelinemetadaten
boolean. Optional. Verwenden Sie , wenn command = push && nuGetFeedType = internal && command = push. Standardwert. true.

Ordnet die Metadaten dieser Build-/Releasepipeline (Run #, Quellcodeinformationen) dem Paket zu.


publishFeedCredentials - NuGet-Server
Eingabealias: externalEndpoint. string. Erforderlich, wenn command = push && nuGetFeedType = external.

Die NuGet-Dienstverbindung , die die Anmeldeinformationen des externen NuGet-Servers enthält.


packagesToPack - Pfad zu csproj- oder nuspec-Dateien, die verpackt werden sollen
Eingabealias: searchPatternPack. string. Erforderlich, wenn command = pack. Standardwert. **/*.csproj.

Das Muster, nach .csproj dem nach oder .nuspec zu packenden Dateien gesucht werden soll.

Sie können mehrere Muster durch ein Semikolon trennen, und Sie können ein Muster als negativ festlegen, indem Sie ihm das Präfix ! voranstellen. Beispiel: **/*.csproj;!**/*.Tests.csproj.


configuration - Konfiguration für Paket
Eingabealias: configurationToPack. string. Optional. Verwenden Sie , wenn command = pack. Standardwert. $(BuildConfiguration).

Wenn Sie eine .csproj Datei verwenden, gibt diese Eingabe die zu packende Konfiguration an.


packDirectory - Paketordner
Eingabealias: outputDir. string. Optional. Verwenden Sie , wenn command = pack. Standardwert. $(Build.ArtifactStagingDirectory).

Der Ordner, in dem Pakete erstellt werden. Wenn dieser Ordner leer ist, werden Pakete zusammen mit der csproj Datei erstellt.


nobuild - Nicht erstellen
boolean. Optional. Verwenden Sie , wenn command = pack. Standardwert. false.

Gibt an, dass der Task das Projekt nicht vor dem Packen erstellt. Diese Aufgabe entspricht dem --no-build Parameter des build Befehls.


includesymbols - Einschließen von Symbolen
boolean. Optional. Verwenden Sie , wenn command = pack. Standardwert. false.

Erstellt NuGet-Pakete mit Symbolen. Dieser Task entspricht dem --include-symbols Befehlszeilenparameter.


includesource - Quelle einschließen
boolean. Optional. Verwenden Sie , wenn command = pack. Standardwert. false.

Schließt Quellcode in das Paket ein. Dieser Task entspricht dem --include-source Befehlszeilenparameter.


versioningScheme - Automatische Paketversionsverwaltung
string. Erforderlich, wenn command = pack. Zulässige Werte: off, byPrereleaseNumber (Datum und Uhrzeit verwenden), byEnvVar (Verwenden Sie eine Umgebungsvariable), byBuildNumber (Verwenden Sie die Buildnummer). Standardwert. off.

Dieser Task kann nicht mit eingeschlossenen Projekten verwendet werden, auf die verwiesen wird. Wenn Sie auswählenUse the date and time, generiert dies eine SemVer-kompatible Version, die so formatiert ist, dass X.Y.Z-ci-datetime Sie , Yund ZauswählenX.

Wenn Sie Use an environment variable auswählen, müssen Sie eine Umgebungsvariable auswählen und sicherstellen, dass sie die Versionsnummer enthält, die Sie verwenden möchten.

Wenn Sie Use the build number auswählen, wird die Buildnummer für die Versionsverwaltung Ihres Pakets verwendet. Hinweis: Legen Sie unter Optionsdas Buildnummernformat auf fest $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r).


versionEnvVar - Umgebungsvariable
string. Erforderlich, wenn versioningScheme = byEnvVar && command = pack.

Gibt den Variablennamen ohne $, $envoder %an.


majorVersion - Haupt
Eingabealias: requestedMajorVersion. string. Erforderlich, wenn versioningScheme = byPrereleaseNumber && command = pack. Standardwert. 1.

Die X in Version X.Y.Z.


minorVersion - Kleiner
Eingabealias: requestedMinorVersion. string. Erforderlich, wenn versioningScheme = byPrereleaseNumber && command = pack. Standardwert. 0.

Die Y in Version X.Y.Z.


patchVersion - Patch
Eingabealias: requestedPatchVersion. string. Erforderlich, wenn versioningScheme = byPrereleaseNumber && command = pack. Standardwert. 0.

Die Z in Version X.Y.Z.


buildProperties - Zusätzliche Buildeigenschaften
string. Optional. Verwenden Sie , wenn command = pack.

Gibt eine Liste von token = value Paaren an, getrennt durch Semikolons, wobei jedes Vorkommen von $token$ in der .nuspec Datei durch den angegebenen Wert ersetzt wird. Die Werte können Zeichenfolgen in Anführungszeichen sein.


verbosityPack - Ausführlichkeit
string. Optional. Verwenden Sie , wenn command = pack. Zulässige Werte: -, Quiet, Minimal, DetailedNormal, , . Diagnostic Standardwert. Detailed.

Gibt die Menge der Details an, die in der Ausgabe für den Befehl pack angezeigt werden.


workingDirectory - Arbeitsverzeichnis
string. Optional. Verwenden Sie , wenn command != restore && command != push && command != pack && command != pack && command != push && command != restore.

Das aktuelle Arbeitsverzeichnis, in dem das Skript ausgeführt wird. Empty ist der Stamm des Repositorys (Build) oder der Artefakte (Release), also $(System.DefaultWorkingDirectory).


workingDirectory - Arbeitsverzeichnis
string. Optional. Verwenden Sie , wenn command != pack && command != push && command != restore.

Das aktuelle Arbeitsverzeichnis, in dem das Skript ausgeführt wird. Empty ist der Stamm des Repositorys (Build) oder der Artefakte (Release), also $(System.DefaultWorkingDirectory).


Optionen für die Vorgangskontrolle

Alle Vorgänge verfügen zusätzlich zu ihren Eingaben über Steuerungsoptionen. Weitere Informationen finden Sie unter Steuerungsoptionen und allgemeine Aufgabeneigenschaften.

Ausgabevariablen

Keine.

Hinweise

Wichtig

Die Aufgabe NuGet-Authentifizierung ist die neue empfohlene Methode für die Authentifizierung bei Azure Artifacts und anderen NuGet-Repositorys. Die restore Befehle und push dieser .NET Core-CLI-Aufgabe verwenden keine neuen Features mehr, und es werden nur kritische Fehler behoben.

Warum schlägt mein Build-, Veröffentlichungs- oder Testschritt beim Wiederherstellen von Paketen fehl?

Die meisten dotnet-Befehle, einschließlich build, publish und test, enthalten einen impliziten restore-Schritt. Dieser Schritt schlägt bei authentifizierten Feeds fehl, auch wenn Sie in einem früheren Schritt einen dotnet restore-Vorgang erfolgreich ausgeführt haben, da im vorherigen Schritt die verwendeten Anmeldeinformationen bereinigt wurden.

Um dieses Problem zu beheben, fügen Sie dem Textfeld das --no-restoreArguments Flag hinzu.

Darüber hinaus erkennt der test Befehl die feedRestore Argumente oder vstsFeed nicht, und die auf diese Weise angegebenen Feeds werden nicht in die generierte NuGet.config Datei eingeschlossen, wenn der implizite restore Schritt ausgeführt wird. Es wird empfohlen, einen expliziten dotnet restore Schritt zum Wiederherstellen von Paketen zu verwenden. Beim Befehl restore werden die Argumente feedRestore und vstsFeed berücksichtigt.

Warum erhalte ich NU1507-Warnungen mit der Paketquellzuordnung , obwohl beim Erstellen auf meinem Computer keine Warnungen angezeigt werden?

Die verschiedenen Befehle, die eine NuGet-Wiederherstellung durchführen oder auf einen NuGet-Feed zugreifen, erstellen eine spezielle temporäre NuGet.config Datei, die nuGet-Authentifizierung für NuGet-Feeds von Azure-Artefakten hinzufügen. Dies steht in Konflikt mit dem Schema, das die Paketquellzuordnung verwendet, um die Pakete den Quellen zuzuordnen, und unterbricht die Konfiguration der Paketquellzuordnung in der NuGet.config Datei in Ihrem Repository. Um diesen Konflikt zu umgehen, können Sie die NuGet-Authentifizierungsaufgabe verwenden, um sich zu authentifizieren, und anschließend den benutzerdefinierten Befehl, um den gewünschten dotnet-Befehl ohne die NuGet.config Änderung aufzurufen.

# Authenticate Azure DevOps NuGet feed
- task: NuGetAuthenticate@1
  displayName: 'Authenticate Azure DevOps NuGet feed'

# Restore project
- task: DotNetCoreCLI@2
  inputs:
    command: 'custom'
    custom: 'restore'

# Build project
- task: DotNetCoreCLI@2
  inputs:
    command: 'custom'
    custom: 'build'
    arguments: '--no-restore'

Warum sollte ich eine NuGet.config-Datei einchecken?

Durch das Einchecken von in NuGet.config die Quellcodeverwaltung wird sichergestellt, dass jeder Entwickler, der Ihren Code auscheckt, eine wichtige Information zur Verfügung steht, die zum Erstellen Ihres Projekts erforderlich ist– der Speicherort seiner Pakete.

In Situationen, in denen ein Entwicklerteam an einer vielzahl von Projekten arbeitet, ist es jedoch auch möglich, einen Azure Artifacts-Feed dem globalen NuGet.config Auf dem Computer jedes Entwicklers hinzuzufügen. In diesen Situationen repliziert die Verwendung der Feeds I select here Option im NuGet-Task diese Konfiguration.

Problembehandlung

Projekt mit Entity Framework funktioniert nicht mehr für gehostete Agents

In .NET Core ist Entity Framework(EF) nicht integriert. Sie müssen EF entweder installieren, bevor Sie mit der Ausführung beginnen oder dem Projekt mit der erforderlichen .NET Core SDK-Version hinzufügen global.json . Dadurch wird sichergestellt, dass das richtige SDK zum Erstellen eines EF-Projekts verwendet wird. Wenn die erforderliche Version auf dem Computer nicht vorhanden ist, fügen Sie die UseDotNetV2 Aufgabe ihrer Pipeline hinzu, um die erforderliche Version zu installieren. Weitere Informationen finden Sie unter Abrufen der Entity Framework Core-Runtime.

Beispiele

Buildbeispiele

Erstellen eines Projekts

# Build project
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'

Erstellen mehrerer Projekte

# Build multiple projects
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
    projects: |
      src/proj1/proj1.csproj 
      src/proj2/proj2.csproj 
      src/other/other.sln    # Pass a solution instead of a csproj.

Pushbeispiele

Pushen von NuGet-Paketen in internem Feed

# Push non test NuGet packages from a build to internal organization Feed
- task: DotNetCoreCLI@2
  inputs:
    command: 'push'
    searchPatternPush: '$(Build.ArtifactStagingDirectory)/*.nupkg;!$(Build.ArtifactStagingDirectory)/*.Tests.nupkg'
    feedPublish: 'FabrikamFeed'

Pushen von NuGet-Paketen in externem Feed

# Push all NuGet packages from a build to external Feed
- task: DotNetCoreCLI@2
  inputs:
    command: 'push'
    nugetFeedType: 'external'
    externalEndPoint: 'MyNuGetServiceConnection'

Packbeispiele

Paketieren eines NuGetPackage in einem bestimmten Ausgabeverzeichnis

# Pack a NuGet package to a test directory
- task: DotNetCoreCLI@2
  inputs: 
    command: 'pack'
    outputDir: '$(Build.ArtifactStagingDirectory)/TestDir'

Erstellen eines Symbolpakets

# Pack a symbol package along with NuGet package
- task: DotNetCoreCLI@2
  inputs: 
    command: 'pack'
    includesymbols: true

Veröffentlichen von Beispielen

Veröffentlichen von Projekten im angegebenen Ordner

# Publish projects to specified folder.
- task: DotNetCoreCLI@2
  displayName: 'dotnet publish'
  inputs:
    command: 'publish'
    publishWebProjects: false
    projects: '**/*.csproj'
    arguments: '-o $(Build.ArtifactStagingDirectory)/Output'
    zipAfterPublish: true
    modifyOutputPath: true

Beispiele für Wiederherstellungen

#Restore packages with the .NET Core CLI task
- task: DotNetCoreCLI@2
  displayName: 'dotnet restore'
  inputs:
    command: 'restore'
    feedsToUse: 'select'
    feedRestore: 'projectName/feedName'
    projects: '**/*.csproj'
    includeNuGetOrg: true

Testbeispiele

Ausführen von Tests in Ihrem Repository

# Run tests and auto publish test results.
- task: DotNetCoreCLI@2
  inputs:
    command: 'test'

Anforderungen

Anforderung BESCHREIBUNG
Pipelinetypen YAML, Klassischer Build, klassisches Release
Wird ausgeführt auf Agent
Forderungen Keine
Capabilities Diese Aufgabe erfüllt keine Anforderungen an nachfolgende Aufgaben im Auftrag.
Befehlseinschränkungen Any
Setzbare Variablen Any
Agent-Version 2.144.0 oder höher
Aufgabenkategorie Entwickeln
Anforderung BESCHREIBUNG
Pipelinetypen YAML, Klassischer Build, klassisches Release
Wird ausgeführt auf Agent
Forderungen Keine
Capabilities Diese Aufgabe erfüllt keine Anforderungen an nachfolgende Aufgaben im Auftrag.
Befehlseinschränkungen Any
Setzbare Variablen Any
Agent-Version 2.115.0 oder höher
Aufgabenkategorie Entwickeln
Anforderung BESCHREIBUNG
Pipelinetypen YAML, Klassischer Build, klassisches Release
Wird ausgeführt auf Agent
Forderungen Keine
Capabilities Diese Aufgabe erfüllt keine Anforderungen an nachfolgende Aufgaben im Auftrag.
Befehlseinschränkungen Any
Setzbare Variablen Any
Agent-Version 2.0.0 oder höher
Aufgabenkategorie Entwickeln