1.1 创建Azure Artifacts Feed
1.1.1 创建Nuget Feed
使用FeedName可以用来做Nuget推送的用的
1.1.2 查看Feed信息
1.2 创建Azure Pipelines
1.2.1 选择源码管理器
(Azure DevOps、GitHub、Git…)
1.2.2 选择项目
1.2.3 编辑自动化脚本,如下:
# ASP.NET Core # Build and test ASP.NET Core projects targeting .NET Core. # Add steps that run tests, create a NuGet package, deploy, and more: # https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core trigger: - master pool: vmImage: 'ubuntu-latest' variables: buildConfiguration: 'Release' version: 1.0.0.1 steps: - script: | dotnet restore KC.Framework/KC.Framework.csproj dotnet build KC.Framework/KC.Framework.csproj -c $(buildConfiguration) dotnet pack KC.Framework/KC.Framework.csproj -c $(buildConfiguration) /p:PackageVersion=$(version) --output $(Build.ArtifactStagingDirectory) --no-build --no-restore displayName: 'dotnet build & pack KC.Framework.csproj' #dotnet restore project from Azure Artifacts - task: DotNetCoreCLI@2 inputs: command: 'restore' projects: 'KC.Common/KC.Common.csproj' feedsToUse: 'select' vstsFeed: 'KCloudy.Core' versioningScheme: 'off' - script: | dotnet build KC.Common/KC.Common.csproj -c $(buildConfiguration) dotnet pack KC.Common/KC.Common.csproj -c $(buildConfiguration) /p:PackageVersion=$(version) --output $(Build.ArtifactStagingDirectory) --no-build --no-restore displayName: 'dotnet build & pack KC.Common.csproj' #dotnet nuget push to Azure Artifacts - task: NuGetCommand@2 displayName: 'NuGet push to KCloudy.Core' inputs: command: 'push' feedsToUse: 'select' packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg;!$(Build.ArtifactStagingDirectory)/*.symbols.nupkg' nuGetFeedType: 'internal' publishVstsFeed: 'KCloudy.Core' versioningScheme: 'off' allowPackageConflicts: true
1.3 执行脚本,打包并推送至Azure Artifacts Feed
1.4 执行结果