issue at moment to run the pipeline an error appear

91 views Asked by At

I am running an azure pipeline my code is on C# .net and msbuild 15, I’m having some issues at moment to run the pipeline an error appear I think is related to the packages.

Here is the error.

Package 'Sitecore.Analytics.Model.NoReferences 9.0.180604' is not found in the following primary source(s): 'C:\Users\VssAdministrator.nuget\packages\nuget'. Please verify all your online package sources are available (OR) package id, version are specified correctly.

enter image description here

I checked and I can see the pack with the correct version of the package in the path.

enter image description here

Any idea how to solve ? do I need to setup something in the job to run this pipe line ?

Thanks in advance.

install Sitecore.Analytics.Model.NoReferences -Version 9.0.180604 checked my packages, disabled central package manager

1

There are 1 answers

1
SiddheshDesai On

By Default SiteCore will not include NoReference packages, As the default packages will come with the required dependency and DLL’s installed. So you can directly add the SiteCore Packages from this official link.

But as you are using external packages, You can refer this blog Create one nuget.config File in your Project or Solution with the Path to your packages.

I have added this URL in my nuget package manager:-

https://pkgs.dev.azure.com/sid24desai0738/_packaging/Get-Hello/nuget/v2

enter image description here

Added Sitecore.Analytics.Aggregation.NoReferences

enter image description here

I have sent this Project in my Azure DevOps repository and then built it by adding one nuget.config file in my Repo:-

My nuget.config file:-

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="MyCustomFeed" value="https://sitecore.myget.org/F/sc-packages/api/v3/index.json" />
  </packageSources>
</configuration>

My Azure DevOps yaml code:-

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1


- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '$(solution)'
    feedsToUse: 'config'
    nugetConfigPath: '$(System.DefaultWorkingDirectory)/nuget.config'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

Output:-

enter image description here

Make sure the package that you created is in correct path or else, And you can also run below pipeline with your feed:-

trigger:
- main

pool:
  vmImage: 'windows-latest'

steps:
- task: NuGetToolInstaller@1
  displayName: 'Install NuGet'
  inputs:
    versionSpec: '5.x'

- task: NuGetCommand@2
  displayName: 'Restore NuGet packages'
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'
    vstsFeed: '<your-feed-name>'
    includeNuGetOrg: true

- task: VSBuild@1
  displayName: 'Build solution'
  inputs:
    solution: '**/*.sln'
    platform: 'Any CPU'
    configuration: 'Release'

- task: NuGetCommand@2
  displayName: 'Pack NuGet packages'
  inputs:
    command: 'pack'
    packagesToPack: '**/*.csproj'
    versioningScheme: 'byEnvVar'
    versionEnvVar: 'BUILD_BUILDNUMBER'
    includeSymbols: true
    includeSource: true
    buildProperties: 'Configuration=Release'

- task: NuGetCommand@2
  displayName: 'Push NuGet packages'
  inputs:
    command: 'push'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
    nuGetFeedType: 'internal'
    publishVstsFeed: '<your-feed-name>'
    allowPackageConflicts: true