DotNetCoreCLI@2 - .NET Core v2 작업

dotnet 애플리케이션을 빌드, 테스트, 패키지 또는 게시하거나 사용자 지정 dotnet 명령을 실행합니다.

dotnet 애플리케이션을 빌드, 테스트, 패키지 또는 게시하거나 사용자 지정 dotnet 명령을 실행합니다. 패키지 명령의 경우 패키지 관리 및 MyGet와 같이 인증된 피드와 NuGet.org를 지원합니다.

중요

NuGet 인증 작업은 Azure Artifacts 및 기타 NuGet 리포지토리를 사용하여 인증하는 새로운 권장 방법입니다. restore 이 .NET Core CLI 작업의 및 push 명령은 더 이상 새로운 기능을 사용하지 않으며 중요한 버그만 해결됩니다. 자세한 내용은 설명을 참조하세요.

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.

입력

command - 명령
string. 필수 요소. 허용되는 값: build, push (nuget push), pack, publish, , restore, run, test, . custom 기본값은 build입니다.

실행할 dotnet 명령입니다. 인수를 추가하거나 여기에 나열되지 않은 명령을 사용하도록 지정 custom 합니다.

중요

NuGet 인증 작업은 Azure Artifacts 및 기타 NuGet 리포지토리를 사용하여 인증하는 새로운 권장 방법입니다. restore 이 .NET Core CLI 작업의 및 push 명령은 더 이상 새로운 기능을 사용하지 않으며 중요한 버그만 해결됩니다. 자세한 내용은 설명을 참조하세요.


publishWebProjects - 웹 프로젝트 게시
boolean. 선택 사항입니다. 을 사용할 때 command = publish사용합니다. 기본값은 true입니다.

이 입력이 로 trueprojects 설정된 경우 속성 값을 건너뛰고 태스크가 리포지토리에서 웹 프로젝트를 찾아 게시 명령을 실행하려고 시도합니다. 웹 프로젝트는 디렉터리에 파일 또는 폴더가 web.configwwwroot 있는 것으로 식별됩니다. 파일 또는 wwwroot 폴더가 web.config 없는 경우 와 같은 Microsoft.NET.Sdk.Web웹 SDK를 사용하는 프로젝트가 선택됩니다.


publishWebProjects - 웹 프로젝트 게시
boolean. 선택 사항입니다. 을 사용할 때 command = publish사용합니다. 기본값은 true입니다.

이 입력이 로 trueprojects 설정된 경우 속성 값을 건너뛰고 태스크가 리포지토리에서 웹 프로젝트를 찾아 게시 명령을 실행하려고 시도합니다. 웹 프로젝트는 디렉터리에 파일 또는 폴더가 web.configwwwroot 있는 것으로 식별됩니다. 파일 또는 wwwroot 폴더가 web.config 없는 경우 와 같은 Microsoft.NET.Sdk.Web웹 SDK를 사용하는 프로젝트가 선택됩니다.


projects - 프로젝트 또는 솔루션에 대한 경로
string. 선택 사항입니다. 을 사용할 때 command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false사용합니다.

사용할 또는 .sln 파일의 경로 .csproj 입니다. 와일드카드(예: **/*.csproj 모든 하위 폴더의 모든 .csproj 파일에 대해)를 사용할 수 있습니다. 자세한 내용은 파일 일치 패턴 참조를 참조하세요.

이 경로는 설정에 관계없이 리포지토리의 루트를 기준으로 합니다 workingDirectory .


projects - 프로젝트 경로
string. 선택 사항입니다. 을 사용할 때 command = build || command = restore || command = run || command = test || command = custom || publishWebProjects = false사용합니다.

사용할 파일의 .csproj 경로입니다. 와일드카드(예: **/*.csproj 모든 하위 폴더의 모든 .csproj 파일에 대해)를 사용할 수 있습니다. 자세한 내용은 파일 일치 패턴 참조를 참조하세요.

이 경로는 설정에 관계없이 리포지토리의 루트를 기준으로 합니다 workingDirectory .


custom - 사용자 지정 명령
string. 필요한 경우 command = custom입니다.

실행을 위해 에 전달할 dotnet.exe 명령입니다. 사용 가능한 명령의 전체 목록은 dotnet CLI 설명서를 참조하세요.


arguments - 인수
string. 선택 사항입니다. 을 사용할 때 command = build || command = publish || command = run || command = test || command = custom사용합니다.

선택한 명령에 대한 인수를 지정합니다. 예를 들어 빌드 구성, 출력 폴더 및 런타임이 있습니다. 인수는 선택한 명령에 따라 달라집니다.

이 입력은 현재 , , , run및 에 대한 build인수만 허용합니다custom. testpublish 나열되지 않은 명령에 대한 인수를 추가하려면 를 사용합니다 custom.


restoreArguments - 인수
string. 선택 사항입니다. 을 사용할 때 command = restore사용합니다.

명령에 전달할 추가 인수를 restore 씁니다.


publishTestResults - 테스트 결과 및 코드 검사 게시
boolean. 선택 사항입니다. 을 사용할 때 command = test사용합니다. 기본값은 true입니다.

이 옵션을 사용하도록 설정하면 에서 $(Agent.TempDirectory)TRX 파일이 생성 test results 되고 결과가 서버에 게시됩니다.

이 옵션은 명령줄 인수에 추가됩니다 --logger trx --results-directory $(Agent.TempDirectory) .

명령줄 인수에 옵션을 추가하여 --collect "Code coverage" 코드 검사를 수집할 수 있습니다.


testRunTitle - 테스트 실행 제목
string. 선택 사항입니다. 을 사용할 때 command = test사용합니다.

테스트 실행의 이름을 제공합니다.


zipAfterPublish - 게시된 프로젝트 Zip
boolean. 선택 사항입니다. 을 사용할 때 command = publish사용합니다. 기본값은 true입니다.

이 입력이 로 true설정된 경우 publish 명령으로 만든 폴더가 압축되고 삭제됩니다.


zipAfterPublish - Zip 게시된 프로젝트
boolean. 선택 사항입니다. 을 사용할 때 command = publish사용합니다. 기본값은 true입니다.

이 입력을 로 true설정하면 publish 명령으로 만든 폴더가 압축되고 삭제됩니다.


modifyOutputPath - 게시 경로에 프로젝트의 폴더 이름 추가
boolean. 선택 사항입니다. 을 사용할 때 command = publish사용합니다. 기본값은 true입니다.

이 입력이 로 true설정된 경우 게시 명령에서 만든 폴더에는 출력 경로가 인수에 명시적으로 지정될 때 해당 폴더 이름 앞에 프로젝트 파일 이름이 접두사로 지정됩니다. 여러 프로젝트를 동일한 폴더에 게시하려는 경우에 유용합니다.


modifyOutputPath - 게시 경로에 프로젝트 이름 추가
boolean. 선택 사항입니다. 을 사용할 때 command = publish사용합니다. 기본값은 true입니다.

이 입력이 로 true설정된 경우 게시 명령에서 만든 폴더에는 출력 경로가 인수에 명시적으로 지정될 때 해당 폴더 이름 앞에 프로젝트 파일 이름이 접두사로 지정됩니다. 여러 프로젝트를 동일한 폴더에 게시하려는 경우에 유용합니다.


feedsToUse - 사용할 피드
입력 별칭: selectOrConfig. string. 필요한 경우 command = restore입니다. 허용되는 값: select (여기서 선택한 피드), config (내 NuGet.config 피드). 기본값은 select입니다.

Azure Artifacts 및/또는 NuGet.org 여기에서 피드를 선택하거나 소스 코드 리포지토리에 파일을 커밋 nuget.config 하고 입력을 사용하여 nugetConfigPath 경로를 설정할 수 있습니다.


vstsFeed - 이 Azure Artifacts 피드에서 패키지 사용
입력 별칭: feedRestore. string. 선택 사항입니다. 을 사용할 때 selectOrConfig = select && command = restore사용합니다.

생성된 NuGet.config에 선택한 피드를 포함합니다. 여기에서 피드를 선택하려면 패키지 관리가 설치되고 라이선스가 있어야 합니다. projectName/feedName 는 프로젝트 범위 피드에 사용됩니다. 범위가 organization 피드에만 FeedName 사용됩니다. 참고: 테스트 명령에는 지원되지 않습니다.


vstsFeed - 이 Azure Artifacts/TFS 피드의 패키지 사용
입력 별칭: feedRestore. string. 선택 사항입니다. 을 사용할 때 selectOrConfig = select && command = restore사용합니다.

생성된 NuGet.config에 선택한 피드를 포함합니다. 여기에서 피드를 선택하려면 패키지 관리가 설치되고 라이선스가 있어야 합니다. projectName/feedName 는 프로젝트 범위 피드에 사용됩니다. 범위가 organization 피드에만 FeedName 사용됩니다. 참고: 테스트 명령에는 지원되지 않습니다.


includeNuGetOrg - NuGet.org 패키지 사용
boolean. 선택 사항입니다. 을 사용할 때 selectOrConfig = select && command = restore사용합니다. 기본값은 true입니다.

생성된 에 를 NuGet.config포함합니다NuGet.org.


nugetConfigPath - NuGet.config경로
string. 선택 사항입니다. 을 사용할 때 selectOrConfig = config && command = restore사용합니다.

NuGet.config 패키지를 복원할 피드를 지정하는 리포지토리의 입니다.


externalFeedCredentials - 이 organization/컬렉션 외부의 피드에 대한 자격 증명
입력 별칭: externalEndpoints. string. 선택 사항입니다. 을 사용할 때 selectOrConfig = config && command = restore사용합니다.

선택한 NuGet.config에 있는 외부 레지스트리에 사용할 자격 증명입니다. 이 organization/컬렉션의 피드의 경우 이 입력을 비워 둡니다. 빌드의 자격 증명이 자동으로 사용됩니다.


noCache - 로컬 캐시 사용 안 함
boolean. 선택 사항입니다. 을 사용할 때 command = restore사용합니다. 기본값은 false입니다.

NuGet이 로컬 머신 캐시의 패키지를 사용하지 못하도록 합니다.


restoreDirectory - 대상 디렉터리
입력 별칭: packagesDirectory. string. 선택 사항입니다. 을 사용할 때 command = restore사용합니다.

패키지가 설치되는 폴더를 지정합니다. 폴더를 지정하지 않으면 패키지가 기본 NuGet 패키지 캐시로 복원됩니다.


verbosityRestore - 세부 정보 표시
string. 선택 사항입니다. 을 사용할 때 command = restore사용합니다. 허용되는 값: -, , QuietMinimal, Normal, , Detailed. Diagnostic 기본값은 Detailed입니다.

명령의 출력 restore 에 표시되는 세부 정보의 양을 지정합니다.


packagesToPush - 게시할 NuGet 패키지 경로
입력 별칭: searchPatternPush. string. 필요한 경우 command = push입니다. 기본값은 $(Build.ArtifactStagingDirectory)/*.nupkg입니다.

일치시킬 패턴 또는 업로드할 nupkg 파일의 경로입니다. 여러 패턴을 세미콜론으로 구분할 수 있으며 접두사를 사용하여 패턴을 음수로 !만들 수 있습니다. 예: **/*.nupkg;!**/*.Tests.nupkg.


nuGetFeedType - 대상 피드 위치
string. 필요한 경우 command = push입니다. 허용되는 값: internal (이 organization/컬렉션), external (외부 NuGet 서버(다른 조직/컬렉션 포함)) 기본값은 internal입니다.

대상 피드가 내부 피드인지 외부인지를 지정합니다.


publishVstsFeed - 대상 피드
입력 별칭: feedPublish. string. 필요한 경우 command = push && nuGetFeedType = internal입니다.

이 organization 호스트되는 피드를 지정합니다. 여기에서 피드를 선택하려면 패키지 관리가 설치되고 라이선스가 있어야 합니다.


publishPackageMetadata - 파이프라인 메타데이터 게시
boolean. 선택 사항입니다. 을 사용할 때 command = push && nuGetFeedType = internal && command = push사용합니다. 기본값은 true입니다.

이 빌드/릴리스 파이프라인의 메타데이터(#, 소스 코드 정보 실행)를 패키지와 연결합니다.


publishFeedCredentials - NuGet 서버
입력 별칭: externalEndpoint. string. 필요한 경우 command = push && nuGetFeedType = external입니다.

외부 NuGet 서버의 자격 증명을 포함하는 NuGet 서비스 연결 입니다.


packagesToPack - 압축할 csproj 또는 nuspec 파일의 경로
입력 별칭: searchPatternPack. string. 필요한 경우 command = pack입니다. 기본값은 **/*.csproj입니다.

검색 .csproj 할 패턴 또는 .nuspec 압축할 파일입니다.

여러 패턴을 세미콜론으로 구분할 수 있으며 접두사를 사용하여 패턴을 음수로 !만들 수 있습니다. 예: **/*.csproj;!**/*.Tests.csproj.


configuration - 구성에서 패키지로
입력 별칭: configurationToPack. string. 선택 사항입니다. 을 사용할 때 command = pack사용합니다. 기본값은 $(BuildConfiguration)입니다.

파일을 사용하는 .csproj 경우 이 입력은 패키지할 구성을 지정합니다.


packDirectory - 패키지 폴더
입력 별칭: outputDir. string. 선택 사항입니다. 을 사용할 때 command = pack사용합니다. 기본값은 $(Build.ArtifactStagingDirectory)입니다.

패키지를 만들 폴더입니다. 이 폴더가 비어 있으면 파일과 함께 패키지가 csproj 만들어집니다.


nobuild - 빌드 안 함
boolean. 선택 사항입니다. 을 사용할 때 command = pack사용합니다. 기본값은 false입니다.

압축하기 전에 작업이 프로젝트를 빌드하지 않도록 지정합니다. 이 작업은 명령의 --no-build 매개 변수에 해당합니다 build .


includesymbols - 기호 포함
boolean. 선택 사항입니다. 을 사용할 때 command = pack사용합니다. 기본값은 false입니다.

기호 NuGet 패키지를 만듭니다. 이 작업은 명령줄 매개 변수에 --include-symbols 해당합니다.


includesource - 원본 포함
boolean. 선택 사항입니다. 을 사용할 때 command = pack사용합니다. 기본값은 false입니다.

패키지에 소스 코드를 포함합니다. 이 작업은 명령줄 매개 변수에 --include-source 해당합니다.


versioningScheme - 자동 패키지 버전 관리
string. 필요한 경우 command = pack입니다. 허용되는 값: off, byPrereleaseNumber (날짜 및 시간 사용), byEnvVar (환경 변수 사용), byBuildNumber (빌드 번호 사용). 기본값은 off입니다.

이 작업은 포함된 참조된 프로젝트에 사용할 수 없습니다. 를 선택하면 Use the date and time, YZ를 선택하는 X위치로 X.Y.Z-ci-datetime 형식이 지정된 SemVer 규격 버전이 생성됩니다.

를 선택하는 Use an environment variable경우 환경 변수를 선택하고 사용하려는 버전 번호가 포함되어 있는지 확인해야 합니다.

를 선택하면 Use the build number빌드 번호를 사용하여 패키지의 버전을 지정합니다. 참고: 에서 Options빌드 번호 형식을 로 $(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)설정합니다.


versionEnvVar - 환경 변수
string. 필요한 경우 versioningScheme = byEnvVar && command = pack입니다.

, $env또는 %가 없는 $변수 이름을 지정합니다.


majorVersion - 주요
입력 별칭: requestedMajorVersion. string. 필요한 경우 versioningScheme = byPrereleaseNumber && command = pack입니다. 기본값은 1입니다.

X 버전 X.Y.Z의 입니다.


minorVersion - 사소한
입력 별칭: requestedMinorVersion. string. 필요한 경우 versioningScheme = byPrereleaseNumber && command = pack입니다. 기본값은 0입니다.

Y 버전 X.Y.Z의 입니다.


patchVersion - 패치
입력 별칭: requestedPatchVersion. string. 필요한 경우 versioningScheme = byPrereleaseNumber && command = pack입니다. 기본값은 0입니다.

Z 버전 X.Y.Z의 입니다.


buildProperties - 추가 빌드 속성
string. 선택 사항입니다. 을 사용할 때 command = pack사용합니다.

세미콜론으로 구분된 쌍 목록을 token = value 지정합니다. 여기서 파일의 $token$.nuspec 각 항목은 지정된 값으로 바뀝니다. 값은 따옴표로 된 문자열일 수 있습니다.


verbosityPack - 세부 정보 표시
string. 선택 사항입니다. 을 사용할 때 command = pack사용합니다. 허용되는 값: -, , QuietMinimal, Normal, , Detailed. Diagnostic 기본값은 Detailed입니다.

명령의 출력 pack 에 표시되는 세부 정보의 양을 지정합니다.


workingDirectory - 작업 디렉터리
string. 선택 사항입니다. 을 사용할 때 command != restore && command != push && command != pack && command != pack && command != push && command != restore사용합니다.

스크립트가 실행되는 현재 작업 디렉터리입니다. Empty 는 리포지토리(빌드) 또는 아티팩트(릴리스)의 루트입니다 $(System.DefaultWorkingDirectory).


workingDirectory - 작업 디렉터리
string. 선택 사항입니다. 을 사용할 때 command != pack && command != push && command != restore사용합니다.

스크립트가 실행되는 현재 작업 디렉터리입니다. Empty 는 리포지토리(빌드) 또는 아티팩트(릴리스)의 루트입니다 $(System.DefaultWorkingDirectory).


작업 제어 옵션

모든 작업에는 작업 입력 외에 제어 옵션이 있습니다. 자세한 내용은 컨트롤 옵션 및 일반적인 작업 속성을 참조하세요.

출력 변수

없음

설명

중요

NuGet 인증 작업은 Azure Artifacts 및 기타 NuGet 리포지토리를 사용하여 인증하는 새로운 권장 방법입니다. restore 이 .NET Core CLI 작업의 및 push 명령은 더 이상 새로운 기능을 사용하지 않으며 중요한 버그만 해결됩니다.

빌드, 게시 또는 테스트 단계가 패키지를 복원하지 못하는 이유는 무엇인가요?

, testpublish및 를 비롯한 build대부분의 dotnet 명령에는 암시적 restore 단계가 포함됩니다. 이전 단계에서 사용한 자격 증명을 정리했으므로 이전 단계에서 성공한 dotnet restore 경우에도 인증된 피드에 대해 실패합니다.

이 문제를 해결하려면 텍스트 상자에 플래그를 Arguments 추가 --no-restore 합니다.

또한 test 명령은 또는 vstsFeed 인수를 feedRestore 인식하지 못하며 이러한 방식으로 지정된 피드는 암시적 restore 단계가 실행될 때 생성된 NuGet.config 파일에 포함되지 않습니다. 명시적 dotnet restore 단계를 사용하여 패키지를 복원하는 것이 좋습니다. 명령은 restorevstsFeed 인수를 feedRestore 존중합니다.

컴퓨터에서 빌드할 때 경고가 없지만 패키지 원본 매핑 으로 NU1507 경고가 표시되는 이유는 무엇인가요?

NuGet을 복원하거나 NuGet 피드에 액세스하는 다양한 명령은 Azure 아티팩트 NuGet 피드에 대한 NuGet 인증을 추가하는 특별한 임시 NuGet.config 파일을 빌드합니다. 이 작업을 수행하는 방법은 패키지 원본 매핑이 패키지를 원본에 매핑하는 데 사용하는 스키마와 충돌하고 리포지토리의 파일에서 패키지 원본 맵핀 구성을 NuGet.config 중단합니다. 이 충돌을 해결하려면 NuGet 인증 작업을 사용하여 인증한 후 사용자 지정 명령을 사용하여 수정 없이 NuGet.config 원하는 dotnet 명령을 호출할 수 있습니다.

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

NuGet.config 검사 이유는 무엇인가요?

NuGet.config 를 소스 제어로 확인하면 코드를 체크 아웃하는 모든 개발자가 프로젝트를 빌드하는 데 필요한 핵심 정보(패키지 위치)를 사용할 수 있습니다.

그러나 개발자 팀이 다양한 프로젝트에서 작업하는 경우 각 개발자의 컴퓨터에서 전역 NuGet.config 으로 Azure Artifacts 피드를 추가할 수도 있습니다. 이러한 경우 NuGet 작업에서 옵션을 사용하면 Feeds I select here 이 구성이 복제됩니다.

문제 해결

Entity Framework를 사용하는 프로젝트가 호스트된 에이전트에서 작동을 중지했습니다.

.NET Core에는 EF(Entity Framework)가 기본 제공되지 않습니다. 실행을 시작하기 전에 EF를 설치하거나 필요한 .NET Core SDK 버전을 사용하여 프로젝트에 추가 global.json 해야 합니다. 이렇게 하면 올바른 SDK가 EF 프로젝트를 빌드하는 데 사용됩니다. 필요한 버전이 컴퓨터에 없는 경우 파이프라인에 작업을 추가하여 UseDotNetV2 필요한 버전을 설치합니다. 자세한 내용은 Entity Framework Core 런타임 가져오기를 참조하세요.

예제

빌드 예제

프로젝트 빌드

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

여러 프로젝트 빌드

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

푸시 예제

NuGet 패키지를 내부 피드에 푸시

# 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 패키지 푸시

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

팩 예제

NuGetPackage를 특정 출력 디렉터리에 압축

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

기호 패키지 압축

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

게시 예제

지정된 폴더에 프로젝트 게시

# 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

복원 예제

#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

테스트 예제

리포지토리에서 테스트 실행

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

요구 사항

요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트
요청 없음
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
Settable 변수 모두
에이전트 버전 2.144.0 이상
작업 범주 빌드
요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트
요청 없음
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
Settable 변수 모두
에이전트 버전 2.115.0 이상
작업 범주 빌드
요구 사항 Description
파이프라인 유형 YAML, 클래식 빌드, 클래식 릴리스
실행 중 에이전트
요청 없음
Capabilities 이 작업은 작업의 후속 작업에 대한 요구를 충족하지 않습니다.
명령 제한 사항 모두
Settable 변수 모두
에이전트 버전 2.0.0 이상
작업 범주 빌드