DotNetCoreCLI@2 - .NET Core v2-taak

Bouw, test, verpakt of publiceer een dotnet-toepassing of voer een aangepaste dotnet-opdracht uit.

Bouw, test, verpakt of publiceer een dotnet-toepassing of voer een aangepaste dotnet-opdracht uit. Voor pakketopdrachten ondersteunt NuGet.org en geverifieerde feeds zoals Pakketbeheer en MyGet.

Belangrijk

De NuGet-verificatietaak is de nieuwe aanbevolen manier om te verifiëren met Azure Artifacts en andere NuGet-opslagplaatsen. De restore opdrachten en push van deze .NET Core CLI-taak nemen geen nieuwe functies meer in beslag en alleen kritieke fouten worden opgelost. Zie opmerkingen voor meer informatie.

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.

Invoerwaarden

command - Opdracht
string. Vereist. Toegestane waarden: build, push (nuget push), pack, publish, restore, run, test, . custom Standaardwaarde: build.

De dotnet-opdracht die moet worden uitgevoerd. Geef custom op om argumenten toe te voegen of gebruik een opdracht die hier niet wordt vermeld.

Belangrijk

De NuGet-verificatietaak is de nieuwe aanbevolen manier om te verifiëren met Azure Artifacts en andere NuGet-opslagplaatsen. De restore opdrachten en push van deze .NET Core CLI-taak nemen geen nieuwe functies meer in beslag en alleen kritieke fouten worden opgelost. Zie opmerkingen voor meer informatie.


publishWebProjects - Webprojecten publiceren
boolean. Optioneel. Gebruik wanneer command = publish. Standaardwaarde: true.

Als deze invoer is ingesteld op true, wordt de waarde van de projects eigenschap overgeslagen en probeert de taak de webprojecten in de opslagplaats te vinden en de publicatieopdracht erop uit te voeren. Webprojecten worden geïdentificeerd door de aanwezigheid van een web.config bestand of een wwwroot map in de map. Als er geen bestand of map wwwroot is, worden projecten geselecteerd die gebruikmaken van web.config een web-SDK, zoals Microsoft.NET.Sdk.Web, .


publishWebProjects - Webprojecten publiceren
boolean. Optioneel. Gebruik wanneer command = publish. Standaardwaarde: true.

Als deze invoer is ingesteld op true, wordt de waarde van de projects eigenschap overgeslagen en probeert de taak de webprojecten in de opslagplaats te vinden en de publicatieopdracht erop uit te voeren. Webprojecten worden geïdentificeerd door de aanwezigheid van een web.config bestand of een wwwroot map in de map. Als er geen bestand of map wwwroot is, worden projecten geselecteerd die gebruikmaken van web.config een web-SDK, zoals Microsoft.NET.Sdk.Web, .


projects - Pad naar project(en) of oplossing(en)
string. Optioneel. Gebruik wanneer command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false.

Het pad naar het bestand .sln of de .csproj bestanden of die u wilt gebruiken. U kunt jokertekens gebruiken (bijvoorbeeld **/*.csproj voor alle .csproj bestanden in alle submappen). Zie de naslaginformatie over bestandsmatchingspatronen voor meer informatie.

Dit pad is relatief ten opzichte van de hoofdmap van de opslagplaats, ongeacht de workingDirectory instelling.


projects - Pad naar project(en)
string. Optioneel. Gebruik wanneer command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false.

Het pad naar de .csproj te gebruiken bestanden. U kunt jokertekens gebruiken (bijvoorbeeld **/*.csproj voor alle .csproj bestanden in alle submappen). Zie de naslaginformatie over bestandsmatchingspatronen voor meer informatie.

Dit pad is relatief ten opzichte van de hoofdmap van de opslagplaats, ongeacht de workingDirectory instelling.


custom - Aangepaste opdracht
string. Vereist wanneer command = custom.

De opdracht die moet worden doorgegeven voor dotnet.exe uitvoering. Zie de dotnet CLI-documentatie voor een volledige lijst met beschikbare opdrachten.


arguments - Argumenten
string. Optioneel. Gebruik wanneer command = build || command = publish || command = run || command = test || command = custom.

Hiermee geeft u de argumenten voor de geselecteerde opdracht. Bijvoorbeeld buildconfiguratie, uitvoermap en runtime. De argumenten zijn afhankelijk van de geselecteerde opdracht.

Deze invoer accepteert momenteel alleen argumenten voor build, publish, run, testen custom. Als u argumenten wilt toevoegen voor een opdracht die niet wordt vermeld, gebruikt customu .


restoreArguments - Argumenten
string. Optioneel. Gebruik wanneer command = restore.

Hiermee schrijft u de extra argumenten die moeten worden doorgegeven aan de restore opdracht.


publishTestResults - Testresultaten en codedekking publiceren
boolean. Optioneel. Gebruik wanneer command = test. Standaardwaarde: true.

Als u deze optie inschakelt, wordt een test results TRX-bestand in $(Agent.TempDirectory)gegenereerd en worden de resultaten gepubliceerd naar de server.

Deze optie wordt toegevoegd aan de opdrachtregelargumenten --logger trx --results-directory $(Agent.TempDirectory) .

Codedekking kan worden verzameld door de --collect "Code coverage" optie toe te voegen aan de opdrachtregelargumenten.


testRunTitle - Titel van testuitvoering
string. Optioneel. Gebruik wanneer command = test.

Geeft een naam op voor de testuitvoering.


zipAfterPublish - Gepubliceerde zip-projecten
boolean. Optioneel. Gebruik wanneer command = publish. Standaardwaarde: true.

Als deze invoer is ingesteld op true, worden mappen die zijn gemaakt met de publicatieopdracht gezipt en verwijderd.


zipAfterPublish - Gepubliceerde projecten zippen
boolean. Optioneel. Gebruik wanneer command = publish. Standaardwaarde: true.

Als deze invoer is ingesteld op true, wordt de map die is gemaakt met de publicatieopdracht gezipt en verwijderd.


modifyOutputPath - De naam van de projectmap toevoegen om het pad te publiceren
boolean. Optioneel. Gebruik wanneer command = publish. Standaardwaarde: true.

Als deze invoer is ingesteld op true, krijgen mappen die zijn gemaakt met de publicatieopdracht het voorvoegsel van het projectbestand als voor hun mapnamen wanneer het uitvoerpad expliciet is opgegeven in argumenten. Dit is handig als u meerdere projecten naar dezelfde map wilt publiceren.


modifyOutputPath - Projectnaam toevoegen om het pad te publiceren
boolean. Optioneel. Gebruik wanneer command = publish. Standaardwaarde: true.

Als deze invoer is ingesteld op true, krijgen mappen die zijn gemaakt met de publicatieopdracht het voorvoegsel van het projectbestand als voor hun mapnamen wanneer het uitvoerpad expliciet is opgegeven in argumenten. Dit is handig als u meerdere projecten naar dezelfde map wilt publiceren.


feedsToUse - Te gebruiken feeds
Invoeralias: selectOrConfig. string. Vereist wanneer command = restore. Toegestane waarden: select (Feed(s) die ik hier selecteer), config (Feeds in mijn NuGet.config). Standaardwaarde: select.

U kunt een feed selecteren uit Azure Artifacts en/of NuGet.org hier, of u kunt een nuget.config bestand doorvoeren in uw broncodeopslagplaats en het pad instellen met behulp van de nugetConfigPath invoer.


vstsFeed - Pakketten uit deze Azure Artifacts-feed gebruiken
Invoeralias: feedRestore. string. Optioneel. Gebruik wanneer selectOrConfig = select && command = restore.

Neemt de geselecteerde feed op in de gegenereerde NuGet.config. U moet Pakketbeheer hebben geïnstalleerd en een licentie hebben om hier een feed te selecteren. projectName/feedName worden gebruikt voor projectgerichte feeds. Alleen FeedName wordt gebruikt voor feeds binnen organisatiebereik. Opmerking: dit wordt niet ondersteund voor de testopdracht.


vstsFeed - Pakketten uit deze Azure Artifacts/TFS-feed gebruiken
Invoeralias: feedRestore. string. Optioneel. Gebruik wanneer selectOrConfig = select && command = restore.

Neemt de geselecteerde feed op in de gegenereerde NuGet.config. U moet Pakketbeheer hebben geïnstalleerd en een licentie hebben om hier een feed te selecteren. projectName/feedName worden gebruikt voor feeds met projectbereik. Alleen FeedName wordt gebruikt voor feeds binnen organisatiebereik. Opmerking: dit wordt niet ondersteund voor de testopdracht.


includeNuGetOrg - Pakketten van NuGet.org gebruiken
boolean. Optioneel. Gebruik wanneer selectOrConfig = select && command = restore. Standaardwaarde: true.

Bevat NuGet.org in de gegenereerde NuGet.config.


nugetConfigPath - Pad naar NuGet.config
string. Optioneel. Gebruik wanneer selectOrConfig = config && command = restore.

De NuGet.config in uw opslagplaats waarmee de feeds worden opgegeven van waaruit pakketten moeten worden hersteld.


externalFeedCredentials - Referenties voor feeds buiten deze organisatie/verzameling
Invoeralias: externalEndpoints. string. Optioneel. Gebruik wanneer selectOrConfig = config && command = restore.

De referenties die moeten worden gebruikt voor externe registers die zich in de geselecteerde NuGet.configbevinden. Voor feeds in deze organisatie/verzameling laat u deze invoer leeg; de referenties van de build worden automatisch gebruikt.


noCache - Lokale cache uitschakelen
boolean. Optioneel. Gebruik wanneer command = restore. Standaardwaarde: false.

Hiermee voorkomt u dat NuGet pakketten uit caches van lokale computers gebruikt.


restoreDirectory - Doelmap
Invoeralias: packagesDirectory. string. Optioneel. Gebruik wanneer command = restore.

Hiermee geeft u de map waarin pakketten zijn geïnstalleerd. Als er geen map is opgegeven, worden pakketten hersteld in de standaard NuGet-pakketcache.


verbosityRestore - Uitgebreidheid
string. Optioneel. Gebruik wanneer command = restore. Toegestane waarden: -, Quiet, Minimal, Normal, Detailed, , . Diagnostic Standaardwaarde: Detailed.

Hiermee geeft u de hoeveelheid details op die wordt weergegeven in de uitvoer voor de restore opdracht.


packagesToPush - Pad naar NuGet-pakket(en) om te publiceren
Invoeralias: searchPatternPush. string. Vereist wanneer command = push. Standaardwaarde: $(Build.ArtifactStagingDirectory)/*.nupkg.

Het patroon dat overeenkomt met of het pad naar nupkg bestanden die moeten worden geüpload. Meerdere patronen kunnen worden gescheiden door een puntkomma en u kunt een patroon negatief maken door het voorvoegsel te voorzien van !. Bijvoorbeeld: **/*.nupkg;!**/*.Tests.nupkg.


nuGetFeedType - Locatie van doelfeed
string. Vereist wanneer command = push. Toegestane waarden: internal (Deze organisatie/verzameling), external (externe NuGet-server (inclusief andere organisaties/verzamelingen)). Standaardwaarde: internal.

Hiermee geeft u op of de doelfeed intern of extern is.


publishVstsFeed - Doelfeed
Invoeralias: feedPublish. string. Vereist wanneer command = push && nuGetFeedType = internal.

Hiermee geeft u een feed op die wordt gehost in deze organisatie. U moet Pakketbeheer hebben geïnstalleerd en een licentie hebben om hier een feed te selecteren.


publishPackageMetadata - Metagegevens van pijplijn publiceren
boolean. Optioneel. Gebruik wanneer command = push && nuGetFeedType = internal && command = push. Standaardwaarde: true.

Koppelt de metagegevens van deze build/release-pijplijn (run #, broncode-informatie) aan het pakket.


publishFeedCredentials - NuGet-server
Invoeralias: externalEndpoint. string. Vereist wanneer command = push && nuGetFeedType = external.

De NuGet-serviceverbinding die de referenties van de externe NuGet-server bevat.


packagesToPack - Pad naar csproj of nuspec-bestand(en) om in te pakken
Invoeralias: searchPatternPack. string. Vereist wanneer command = pack. Standaardwaarde: **/*.csproj.

Het patroon dat moet worden gezocht .csproj of .nuspec bestanden die moeten worden ingepakt.

U kunt meerdere patronen scheiden met een puntkomma en u kunt een patroon negatief maken door het voorvoegsel te voorzien van !. Bijvoorbeeld: **/*.csproj;!**/*.Tests.csproj.


configuration - Configuratie naar pakket
Invoeralias: configurationToPack. string. Optioneel. Gebruik wanneer command = pack. Standaardwaarde: $(BuildConfiguration).

Wanneer u een .csproj bestand gebruikt, geeft deze invoer de configuratie aan die moet worden verpakt.


packDirectory - Pakketmap
Invoeralias: outputDir. string. Optioneel. Gebruik wanneer command = pack. Standaardwaarde: $(Build.ArtifactStagingDirectory).

De map waarin pakketten worden gemaakt. Als deze map leeg is, worden er pakketten gemaakt naast het csproj bestand.


nobuild - Niet bouwen
boolean. Optioneel. Gebruik wanneer command = pack. Standaardwaarde: false.

Hiermee geeft u op dat de taak het project niet bouwt voordat het inpakken. Deze taak komt overeen met de --no-build parameter van de build opdracht.


includesymbols - Symbolen opnemen
boolean. Optioneel. Gebruik wanneer command = pack. Standaardwaarde: false.

Hiermee maakt u het symbool NuGet-pakketten. Deze taak komt overeen met de --include-symbols opdrachtregelparameter.


includesource - Bron opnemen
boolean. Optioneel. Gebruik wanneer command = pack. Standaardwaarde: false.

Bevat broncode in het pakket. Deze taak komt overeen met de --include-source opdrachtregelparameter.


versioningScheme - Automatisch versiebeheer van pakketten
string. Vereist wanneer command = pack. Toegestane waarden: off, byPrereleaseNumber (Gebruik de datum en tijd), byEnvVar (Gebruik een omgevingsvariabele), byBuildNumber (Gebruik het buildnummer). Standaardwaarde: off.

Deze taak kan niet worden gebruikt met opgenomen projecten waarnaar wordt verwezen. Als u kiest Use the date and time, wordt er een SemVer-compatibele versie gegenereerd die is opgemaakt als X.Y.Z-ci-datetime waar u kiest Xvoor , Yen Z.

Als u kiest voor Use an environment variable, moet u een omgevingsvariabele selecteren en ervoor zorgen dat deze het versienummer bevat dat u wilt gebruiken.

Als u kiest, Use the build numberwordt het buildnummer gebruikt voor de versie van uw pakket. Opmerking: Stel onder Optionsde notatie voor buildnummers in op $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r).


versionEnvVar - Omgevingsvariabele
string. Vereist wanneer versioningScheme = byEnvVar && command = pack.

Hiermee geeft u de naam van de variabele zonder $, $envof %.


majorVersion - Belangrijke
Invoeralias: requestedMajorVersion. string. Vereist wanneer versioningScheme = byPrereleaseNumber && command = pack. Standaardwaarde: 1.

De X in versie X.Y.Z.


minorVersion - Kleine
Invoeralias: requestedMinorVersion. string. Vereist wanneer versioningScheme = byPrereleaseNumber && command = pack. Standaardwaarde: 0.

De Y in versie X.Y.Z.


patchVersion - Patch
Invoeralias: requestedPatchVersion. string. Vereist wanneer versioningScheme = byPrereleaseNumber && command = pack. Standaardwaarde: 0.

De Z in versie X.Y.Z.


buildProperties - Aanvullende build-eigenschappen
string. Optioneel. Gebruik wanneer command = pack.

Hiermee geeft u een lijst met token = value paren op, gescheiden door puntkomma's, waarbij elke instantie van $token$ in het .nuspec bestand wordt vervangen door de opgegeven waarde. Waarden kunnen tekenreeksen tussen aanhalingstekens zijn.


verbosityPack - Uitgebreidheid
string. Optioneel. Gebruik wanneer command = pack. Toegestane waarden: -, Quiet, Minimal, Normal, Detailed, . Diagnostic Standaardwaarde: Detailed.

Hiermee geeft u de hoeveelheid details die wordt weergegeven in de uitvoer voor de pack opdracht.


workingDirectory - Werkmap
string. Optioneel. Gebruik wanneer command != restore && command != push && command != pack && command != pack && command != push && command != restore.

De huidige werkmap waarin het script wordt uitgevoerd. Empty is de hoofdmap van de opslagplaats (build) of artefacten (release), namelijk $(System.DefaultWorkingDirectory).


workingDirectory - Werkmap
string. Optioneel. Gebruik wanneer command != pack && command != push && command != restore.

De huidige werkmap waarin het script wordt uitgevoerd. Empty is de hoofdmap van de opslagplaats (build) of artefacten (release), namelijk $(System.DefaultWorkingDirectory).


Opties voor taakbeheer

Alle taken hebben besturingsopties naast hun taakinvoer. Zie Besturingsopties en algemene taakeigenschappen voor meer informatie.

Uitvoervariabelen

Geen.

Opmerkingen

Belangrijk

De taak NuGet-verificatie is de nieuwe aanbevolen manier om te verifiëren met Azure Artifacts en andere NuGet-opslagplaatsen. De restore opdrachten en push van deze .NET Core CLI-taak hebben geen nieuwe functies meer en alleen kritieke fouten worden opgelost.

Waarom kan mijn build-, publicatie- of teststap geen pakketten herstellen?

De meeste dotnet opdrachten, waaronder build, publish, en test bevatten een impliciete restore stap. Dit mislukt voor geverifieerde feeds, zelfs als u een geslaagde dotnet restore hebt uitgevoerd in een eerdere stap, omdat de eerdere stap de gebruikte referenties heeft opgeschoond.

U kunt dit probleem oplossen door de --no-restore vlag toe te voegen aan het Arguments tekstvak.

Bovendien herkent de test opdracht de feedRestore argumenten of vstsFeed niet en worden feeds die op deze manier zijn opgegeven, niet opgenomen in het gegenereerde NuGet.config bestand wanneer de impliciete restore stap wordt uitgevoerd. Het is raadzaam om een expliciete dotnet restore stap te gebruiken om pakketten te herstellen. De restore opdracht respecteert de feedRestore argumenten en vstsFeed .

Waarom krijg ik NU1507-waarschuwingen met pakketbrontoewijzing , hoewel er bij het bouwen op mijn computer geen waarschuwingen zijn?

De verschillende opdrachten die een NuGet-herstel uitvoeren of toegang krijgen tot een NuGet-feed, bouwen een speciaal tijdelijk NuGet.config bestand waarmee NuGet-verificatie voor Azure Artifacts NuGet-feeds wordt toegevoegd. De manier waarop dit wordt gedaan, is in strijd met het schema dat pakketbrontoewijzing gebruikt om de pakketten toe te wijzen aan de bronnen en breekt de configuratie pakketbrontoewijzing in het NuGet.config bestand in uw opslagplaats. Om dit conflict te omzeilen, kunt u de taak NuGet Authenticate gebruiken om te verifiëren en vervolgens de aangepaste opdracht aan te roepen de gewenste dotnet-opdracht aan te roepen zonder de NuGet.config wijziging.

# 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'

Waarom moet ik een NuGet.config inchecken?

Als u een NuGet.config incheckt bij broncodebeheer, zorgt u ervoor dat een belangrijk stukje informatie dat nodig is om uw project te bouwen, de locatie van de pakketten, beschikbaar is voor elke ontwikkelaar die uw code uitcheckt.

Voor situaties waarin een team van ontwikkelaars aan een groot aantal projecten werkt, is het echter ook mogelijk om een Azure Artifacts-feed toe te voegen aan de algemene NuGet.config op de computer van elke ontwikkelaar. In dergelijke situaties wordt deze configuratie gerepliceerd met de Feeds I select here optie in de NuGet-taak.

Problemen oplossen

Project met Entity Framework werkt niet meer op gehoste agents

.NET Core heeft geen EF (Entity Framework) ingebouwd. U moet EF installeren voordat u begint met de uitvoering of toevoegen global.json aan het project met de vereiste .NET Core SDK-versie. Dit zorgt ervoor dat de juiste SDK wordt gebruikt om een EF-project te bouwen. Als de vereiste versie niet aanwezig is op de computer, voegt u de UseDotNetV2 taak toe aan uw pijplijn om de vereiste versie te installeren. Zie De Entity Framework Core-runtime ophalen voor meer informatie.

Voorbeelden

Build-voorbeelden

Een project bouwen

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

Meerdere projecten bouwen

# 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.

Push-voorbeelden

NuGet-pakketten pushen naar interne 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'

NuGet-pakketten pushen naar externe feed

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

Voorbeelden van pakketten

Een NuGetPackage inpakken in een specifieke uitvoermap

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

Een symboolpakket inpakken

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

Voorbeelden publiceren

Projecten publiceren naar opgegeven map

# 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

Voorbeelden van herstelbewerkingen

#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

Testvoorbeelden

Tests uitvoeren in uw opslagplaats

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

Vereisten

Vereiste Beschrijving
Pijplijntypen YAML, klassieke build, klassieke release
Wordt uitgevoerd op Agent
Eisen Geen
Functies Deze taak voldoet niet aan eventuele vereisten voor volgende taken in de taak.
Opdrachtbeperkingen Alle
Instelbare variabelen Alle
Agentversie 2.144.0 of hoger
Taakcategorie Build
Vereiste Beschrijving
Pijplijntypen YAML, klassieke build, klassieke release
Wordt uitgevoerd op Agent
Eisen Geen
Functies Deze taak voldoet niet aan eventuele vereisten voor volgende taken in de taak.
Opdrachtbeperkingen Alle
Instelbare variabelen Alle
Agentversie 2.115.0 of hoger
Taakcategorie Build
Vereiste Beschrijving
Pijplijntypen YAML, klassieke build, klassieke release
Wordt uitgevoerd op Agent
Eisen Geen
Functies Deze taak voldoet niet aan eventuele vereisten voor volgende taken in de taak.
Opdrachtbeperkingen Alle
Instelbare variabelen Alle
Agentversie 2.0.0 of hoger
Taakcategorie Build