I have a solution with 2 Class Library in C#.
I have a pipeline in Azure DevOps that build and publish one NuGet package and it is working. The YAML is
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: DotNetCoreCLI@2
displayName: Restore packages
inputs:
command: 'restore'
projects: '**/*.csproj'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: Build project
inputs:
command: 'build'
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: Run tests
inputs:
command: 'test'
projects: '**/*[Te]ests/*.csproj'
- task: NuGetCommand@2
displayName: Prepare the package
inputs:
command: 'pack'
packagesToPack: '**/*.csproj'
versioningScheme: 'byEnvVar'
versionEnvVar: 'PackageVersion'
- task: NuGetCommand@2
displayName: Push the package
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'xxx'
When I have 2 projects this pipeline failed. I noticed that in the build step, the projects are created in a Debug
folder.
In the "Prepare the package" the pipeline is searching for the .dll in the Release
folder in Azure DevOps.
Then, I have a few of questions:
- is it possible to create and publish more than one package with the same pipeline?
- I'm using Visual Studio 2021 and I haven't created any .nuspec. Do I have to create them?
- Why does Azure DevOps use 2 different folders for build and package? Do I have to pass as argument a different folder?