Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Azure DevOps Pipelines fails when using ReadyToRun

$
0
0

We're currently trying to publish a .NET project in DevOps in Release Mode with ReadyToRun enabled that refers to some artifacts located in another project (Our shared library).

The problem is that each time we run the dotnet publish command, it throws a whole bunch of 401 authorization errors like seen below:

enter image description here

What is really important to mention is that this issue DOES NOT OCCOUR when publishing as Debug or without ReadyToRun.

Microsoft has not been able to help us, and keep pointing out, that there must be an authorization issue since it is giving us a 401. But that doesn't really make sense, when it apparently works fine without ReadyToRun, meaning that it can retreive the artifacts succesfully.

This is the pipeline that we are currently using:

# ASP.NET# Build and test ASP.NET projects.# Add steps that publish symbols, save build artifacts, deploy, and more:# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4trigger:- mainpool:  vmImage: 'windows-2022'variables:  solution: '**/*.sln'  buildPlatform: 'Any CPU'  publish.buildConfiguration: 'Publish'  publish.path: '$(System.DefaultWorkingDirectory)\publish\'  publish.artifactFolderName : 'Packages'  #App API  projectName.appApi: 'Linak.Deskline.Tracking.AppApi'  projectPath.appApi: '.\Sources\Linak.Deskline.Tracking\Linak.Deskline.Tracking.AppApi\$(projectName.appApi).csproj'  ressource.dev.function.appApi: 'func-dtr-app-weu-dev-01'  ressource.tst.function.appApi: 'func-dtr-app-weu-tst-01'  ressource.prod.function.appApi: 'func-dtr-app-weu-prod-01'  #Integrator API  projectName.integratorApi: 'Linak.Deskline.Tracking.integratorApi'  projectPath.integratorApi: '.\Sources\Linak.Deskline.Tracking\Linak.Deskline.Tracking.IntegratorApi\$(projectName.integratorApi).csproj'  ressource.dev.function.integratorApi: 'func-dtr-integrator-weu-dev-01'  ressource.tst.function.integratorApi: 'func-dtr-integrator-weu-tst-01'  ressource.prod.function.integratorApi: 'func-dtr-integrator-weu-prod-01'  #LipDataHandler Api  projectName.lipDataHandler: 'Linak.Deskline.Tracking.LipDataHandler'  projectPath.lipDataHandler: '.\Sources\Linak.Deskline.Tracking\Linak.Deskline.Tracking.LipDataHandler\$(projectName.lipDataHandler).csproj'  ressource.dev.function.lipDataHandler: 'func-dtr-lipevents-weu-dev-01'  ressource.tst.function.lipDataHandler: 'func-dtr-lipevents-weu-tst-01'  ressource.prod.function.lipDataHandler: 'func-dtr-lipevents-weu-prod-01'stages: - stage: Build  jobs:   - job: BuildAndPublishZips    displayName: Build and publish zip files    steps:    - task: NuGetToolInstaller@1      displayName: 'Get Nuget'    - task: NuGetCommand@2      displayName: 'Nuget Restore'      inputs:        command: 'restore'        restoreSolution: '$(solution)'        feedsToUse: 'config'        nugetConfigPath: '.\Sources\Linak.Deskline.Tracking\nuget.config'        arguments: '--runtime win-x86'    - task: DotNetCoreCLI@2      displayName: 'Build and publish - $(projectName.appApi)'      inputs:        command: 'publish'        publishWebProjects: false        projects: '$(projectPath.appApi)'        arguments: '-o $(publish.path) /bl -c $(publish.buildConfiguration)'    - task: DotNetCoreCLI@2      displayName: 'Build and publish - $(projectName.integratorApi) '      inputs:        command: 'publish'        publishWebProjects: false        projects: '$(projectPath.integratorApi)'        arguments: '-o $(publish.path) /bl -c $(publish.buildConfiguration)'    - task: DotNetCoreCLI@2      displayName: 'Build and publish - $(projectName.lipDataHandler)'      inputs:        command: 'publish'        publishWebProjects: false        projects: '$(projectPath.lipDataHandler)'        arguments: '-o $(publish.path) /bl -c $(publish.buildConfiguration)'    - task: DotNetCoreCLI@2      displayName: 'Run tests'      inputs:        command: 'test'        projects: '**\*.csproj'        testRunTitle: 'Deskline Cloud Test'    - task: PublishPipelineArtifact@1      displayName: 'Publishing deploy packages'      inputs:        targetPath: '$(publish.path)'        artifact: '$(publish.artifactFolderName)'        publishLocation: 'pipeline'#DEV- stage: Deploy_DEV  dependsOn: Build  jobs:   - deployment: Deploy_DEV    displayName: 'Deploy to DEV'    environment: 'Tracking - DEV'    strategy:      runOnce:        deploy:          steps:           - task: PowerShell@2              displayName: "List build artifacts"            inputs:              targetType: 'inline'              script: |                # Write your PowerShell commands here.                Write-Host "cd $(Agent.BuildDirectory)/$(publish.artifactFolderName)"                cd $(Agent.BuildDirectory)/$(publish.artifactFolderName)                dir             - task: AzureFunctionApp@1            displayName: 'Deploy DEV - $(projectName.integratorApi)'            inputs:              azureSubscription: 'Deskline Cloud - Development'              appType: 'functionApp'              appName: $(ressource.dev.function.integratorApi)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.integratorApi).zip'              deploymentMethod: 'zipDeploy'          - task: AzureFunctionApp@1            displayName: 'Deploy DEV - $(projectName.appApi)'            inputs:              azureSubscription: 'Deskline Cloud - Development'              appType: 'functionApp'              appName: $(ressource.dev.function.appApi)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.appApi).zip'              deploymentMethod: 'zipDeploy'          - task: AzureFunctionApp@1            displayName: 'Deploy DEV - $(projectName.lipDataHandler)'            inputs:              azureSubscription: 'Deskline Cloud - Development'              appType: 'functionApp'              appName: $(ressource.dev.function.lipDataHandler)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.lipDataHandler).zip'              deploymentMethod: 'zipDeploy'#TEST- stage: Deploy_TEST  dependsOn: 'Deploy_DEV'  jobs:   - deployment: Deploy_TEST    displayName: Deploy to TEST    environment: 'Tracking - TEST'    strategy:      runOnce:        deploy:          steps:           - task: PowerShell@2              displayName: "List build artifacts"            inputs:              targetType: 'inline'              script: |                Write-Host "cd $(Agent.BuildDirectory)/$(publish.artifactFolderName)"                cd $(Agent.BuildDirectory)/$(publish.artifactFolderName)                dir             - task: AzureFunctionApp@1            displayName: 'Deploy TEST - $(projectName.integratorApi)'            inputs:              azureSubscription: 'Deskline Cloud - Test'              appType: 'functionApp'              appName: $(ressource.tst.function.integratorApi)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.integratorApi).zip'              deploymentMethod: 'zipDeploy'          - task: AzureFunctionApp@1            displayName: 'Deploy TEST - $(projectName.appApi)'            inputs:              azureSubscription: 'Deskline Cloud - Test'              appType: 'functionApp'              appName: $(ressource.tst.function.appApi)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.appApi).zip'              deploymentMethod: 'zipDeploy'          - task: AzureFunctionApp@1            displayName: 'Deploy DEV - $(projectName.lipDataHandler)'            inputs:              azureSubscription: 'Deskline Cloud - Test'              appType: 'functionApp'              appName: $(ressource.tst.function.lipDataHandler)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.lipDataHandler).zip'              deploymentMethod: 'zipDeploy'#PROD- stage: Deploy_PROD  dependsOn: 'Deploy_TEST'  jobs:   - deployment: Deploy_PROD    displayName: Deploy to PROD    environment: 'Tracking - PROD'    strategy:      runOnce:        deploy:          steps:           - task: PowerShell@2              displayName: "List build artifacts"            inputs:              targetType: 'inline'              script: |                Write-Host "cd $(Agent.BuildDirectory)/$(publish.artifactFolderName)"                cd $(Agent.BuildDirectory)/$(publish.artifactFolderName)                dir             - task: AzureFunctionApp@1            displayName: 'Deploy PROD - $(projectName.integratorApi)'            inputs:              azureSubscription: 'Deskline Cloud - Production'              appType: 'functionApp'              appName: $(ressource.prod.function.integratorApi)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.integratorApi).zip'              deploymentMethod: 'zipDeploy'          - task: AzureFunctionApp@1            displayName: 'Deploy PROD - $(projectName.appApi)'            inputs:              azureSubscription: 'Deskline Cloud - Production'              appType: 'functionApp'              appName: $(ressource.prod.function.appApi)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.appApi).zip'              deploymentMethod: 'zipDeploy'          - task: AzureFunctionApp@1            displayName: 'Deploy PROD - $(projectName.lipDataHandler)'            inputs:              azureSubscription: 'Deskline Cloud - Production'              appType: 'functionApp'              appName: $(ressource.prod.function.lipDataHandler)              package: '$(Agent.BuildDirectory)/$(publish.artifactFolderName)/$(projectName.lipDataHandler).zip'              deploymentMethod: 'zipDeploy'

It fails in the following step:

- task: DotNetCoreCLI@2  displayName: 'Build and publish - $(projectName.appApi)'  inputs:    command: 'publish'    publishWebProjects: false    projects: '$(projectPath.appApi)'    arguments: '-o $(publish.path) /bl -c $(publish.buildConfiguration)'

We've already tried different things, such as:

  1. Adding -no-restore to the publish command

  2. Adding this part to the pipeline:

    steps:

    • task: UseDotNet@2displayName: 'Use .NET Core sdk 6.0.x'inputs:version: 6.0.x
  3. Ensured that the build service where the authorization fails, has access to the artifacts in the shared library

enter image description here

Microsoft has already had 10 people on the case now, and I don't feel like we are going nowhere. So I thought, maybe someone in here has a better solution?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>