Unable to build the project in AzureDevops

95 Views Asked by At

Unable to build the my application in AzureDevops please help

Code Snip

trigger:
- master

pool:
  vmImage: 'windows-2019'

variables:
  solution: 'sample.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: 'sample.sln'
    feedsToUse: 'select'
    
- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="sample"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Reference Error from Azure Devops:

2023-12-17T07:36:28.2707587Z Restoring NuGet packages...
2023-12-17T07:36:28.2708450Z To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
Error : Unable to find version '4.2.1' of package 'AutoMapper'.
Error : Unable to find version '1.0.0' of package 'CommonServiceLocation'.
Error : Unable to find version '5.0.2806' of package 'Devart.Data'.
Error : Unable to find version '7.22.2014' of package 'Devart.Data.PostgreSql'.
Error : Unable to find version '6.1.3' of package 'EntityFramework'.
Error : Unable to find version '2.0.5' of package 'log4net'.
Error : Unable to find version '3.9.1' of package 'LumenWorksCsvReader'.

please help what is wrong.

followed these steps too# DevArt postgres in AzureDevops

1

There are 1 best solutions below

0
Bright Ran-MSFT On

You can try to configure your NuGet.config like as below to fix the issue:

  1. Add below contents to your NuGet.config. For more details, see "nuget.config reference".

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageRestore>
        <!-- Enable NuGet can perform automatic restore. -->
        <add key="enabled" value="True" />
        <!-- Enable NuGet can check for missing packages during a build. -->
        <add key="automatic" value="True" />
      </packageRestore>
    
      <packageSources>
        <!-- Add nuget.org as a package source. -->
        <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
        <!-- Add the custom artifact feeds as the package sources. -->
        <add key="CustomFeed" value="{URL of the CustomFeed}" />
      </packageSources>
    
      <disabledPackageSources />
    
      <activePackageSource>
        <!-- Active all non-disabled package sources. -->
        <add key="All" value="(Aggregate source)" />
      </activePackageSource>
    
      . . .
    </configuration>
    
  2. In the pipeline, you just need one NuGetCommand@2 task to restore the packages by using the NuGet.config.

  3. If your 'CustomFeed' is a private feed, you may need to add the NuGetAuthenticate@1 task to get the credentials to access the private feed before the NuGetCommand@2 task.