I'm just trying to compile then run tests from the command line. I'm not trying to publish packages. Here's what I ran after I cloned https://github.com/wouter1981/commercial-model:
C:\Users\paul_h\scm\oss\commercial-model>dotnet build
Microsoft (R) Build Engine version 17.0.0 c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
C:\Program Files\dotnet\sdk\6.0.102\NuGet.targets(130,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/ourcompany/_packaging/ourcompany@Local/nuget/v3/index.json. [C:\Users\paul_h\scm\oss\commercial-model\CommercialModel.sln]
C:\Program Files\dotnet\sdk\6.0.102\NuGet.targets(130,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Users\paul_h\scm\oss\commercial-model\CommercialModel.sln]
Build FAILED.
C:\Program Files\dotnet\sdk\6.0.102\NuGet.targets(130,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/ourcompany/_packaging/ourcompany@Local/nuget/v3/index.json. [C:\Users\paul_h\scm\oss\commercial-model\CommercialModel.sln]
C:\Program Files\dotnet\sdk\6.0.102\NuGet.targets(130,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Users\paul_h\scm\oss\commercial-model\CommercialModel.sln]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:02.60
Ideally, I am looking for an option to specify with the dotnet
command in cmd.exe
that will get it to skip the firm's feed and just pull dependencies from the public nuget feed. Say --ignoreGlobalFeed
. I don't think it exists, so what is the alternative for .NET 6.x on the command line?
CodePudding user response:
Add specific NuGet config to solution folder
dotnet new nugetconfig
This will add new file nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
And there you will be able to define package sources.
After that run
dotnet build
Update
Or just add specific nuget feed to build command:
dotnet build --source https://api.nuget.org/v3/index.json