Our project references packages in our private artifact source in Azure DevOps. When building the project in Azure DevOps the dotnet restore completes fine but dotnet build also tries to restore the packages and fails with
Unable to load the service index for source https://myazdevops.pkgs.visualstudio.com/_packaging/OurPackages/nuget/v3/index.json
The work around is adding --no-restore to both the dotnet build and dotnet publish tasks.
Is there some way to have the build and publish start working without there parameters?
I think your workaround is the solution, in the official docs written:
Starting with .NET Core 2.0 SDK, dotnet restore runs implicitly when you run dotnet build. If you want to disable implicit restore when running the build command, you can pass the --no-restore option.
You can't disable this behavior unless you add --no-restore.
See also this question & answer.
I had similar issues with our internal NuGet feed. I resolved it by adding nuget.config file in repository that contains both NuGet.org and our internal NuGet repository.
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="internal" value="URL_TO_INTERNAL_FEED" />
</packageSources>
</configuration>
Then just specify in your Restore step Path to NuGet.config to this file.
Hope it will help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With