I try something like dotnet publish --configuration Release --self-contained true --runtime win-x64 MySolution.Application and I get C:\Program Files\dotnet\sdk\2.1.201\NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). [C:\Repos\MySolution\MySolution.Application\MySolution.Application.csproj]
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Ah, looks like an auth issue. Adding @alexmullans to take a look for ya!
dotnet's auth story is a bit tricky. This page can help: https://docs.microsoft.com/en-us/vsts/package/nuget/dotnet-exe?view=vsts
That doesn't seem to work. I created a PAT, ran the nuget command line
with the url set to v2 as the vsts documentation says to do. nuget
sources list shows my repository. When I try to run dotnet from the
command line, I get a 404 instead of a 401. Progress? In the wrong
direction? Not sure how to tell.
On Tue, Jun 5, 2018 at 9:47 AM, Alex Mullans notifications@github.com
wrote:
dotnet's auth story is a bit tricky. This page can help:
https://docs.microsoft.com/en-us/vsts/package/nuget/dotnet-exe?view=vsts—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/MicrosoftDocs/vsts-docs/issues/972#issuecomment-394715151,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABr4dFkGIkUxm6poUhzr2ycXnfVApVBMks5t5ovygaJpZM4UZhl4
.
NM, it looks like I was led astray by the VSTS documentation, I still
needed to keep it v3.
On Wed, Jun 6, 2018 at 2:48 PM, Jeremy Holovacs jholovacs@gmail.com wrote:
That doesn't seem to work. I created a PAT, ran the nuget command line
with the url set to v2 as the vsts documentation says to do.nuget sources listshows my repository. When I try to run dotnet from the
command line, I get a 404 instead of a 401. Progress? In the wrong
direction? Not sure how to tell.On Tue, Jun 5, 2018 at 9:47 AM, Alex Mullans notifications@github.com
wrote:dotnet's auth story is a bit tricky. This page can help:
https://docs.microsoft.com/en-us/vsts/package/nuget/dotnet-exe?view=vsts—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/MicrosoftDocs/vsts-docs/issues/972#issuecomment-394715151,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABr4dFkGIkUxm6poUhzr2ycXnfVApVBMks5t5ovygaJpZM4UZhl4
.
hi @jholovacs , I know this is a while ago, but what part told you to use anything but v3? I could change that if it's incorrect :)
There's an "instructions" modal when setting up the package repo for how to
connect, basically suggested (at least the way I read it) that I needed to
use PAT and v2 to access this externally.
On Mon, Jun 25, 2018 at 12:36 PM elbatk notifications@github.com wrote:
hi @jholovacs https://github.com/jholovacs , I know this is a while
ago, but what part told you to use anything but v3? I could change that if
it's incorrect :)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/MicrosoftDocs/vsts-docs/issues/972#issuecomment-400015912,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABr4dJ-YzdxhQwb5BQF0RYgZSe7Xoxf_ks5uARGZgaJpZM4UZhl4
.
This doesn't seem to work on Visual Studio for Mac... It's possible to add a private NuGet repository from say VSTS and log in to that account in Visual Studio for Mac. However, the credentials don't seem to work for the NuGet Repository and VS for Mac nags about credentials. The same credentials work fine in Visual Studio (For PC). Please add instructions for VS for Mac. Why don't you release an IDE that works on all platforms.
Adding @alexmullans to address some of the platform/credential questions here.
As of today, the new cross-platform Credential Provider is the way to go if you're using dotnet on the command line (regardless of platform). For VS for Mac, instructions are available here: https://docs.microsoft.com/en-us/azure/devops/artifacts/nuget/consume?view=vsts&tabs=new-nav#macos-add-the-feed-to-your-nuget-configuration
@alexmullans could you please provide some more details on artifacts-credprovider? I followed the instructions from the artifacts-credprovider to install the plugin in my $HOME/.nuget folder. Then tried dotnet restore --interactive but I still get a 401 when querying for packages in the VSTS feed. No authentication was prompted.
Do I still need a clean text PAT configured with artifacts-credprovider?
EDIT: the plugin seems to be installed correctly according to the restore logs - I am just unsure if this plugins is supposed to prompt for authentication or if I need to configure the PAT on it.
$ dotnet restore --interactive --no-cache --verbosity diag
... (omitted some urls / paths)
Using /home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll as a credential provider plugin. (TaskId:38)
17:10:08.562 1>/opt/dotnet/sdk/2.1.401/NuGet.targets(114,5): error : Unable to load the service index for source ...
/opt/dotnet/sdk/2.1.401/NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). ...
NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://.....pkgs.visualstudio.com/_packaging/Official/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
That should work. @keithrob any ideas?
@andreesteve,
Are you using TFS or Visualstudio.com?
@keithrob I am using visualstudio.com (that's where the feed is). Here's dotnet --info if it helps:
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /opt/dotnet/sdk/2.1.401/
Host (useful for support):
Version: 2.1.3
Commit: 124038c13e
.NET Core SDKs installed:
2.1.401 [/opt/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.3 [/opt/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.3 [/opt/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.3 [/opt/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
@andreesteve ,
dotnet version looks fine. Can you send the output of tree $HOME\.nuget\plugins?
@andreesteve ,
Also, make sure that you do not have credentials anywhere in your nuget.config(s).
Contents of ~/.nuget:
/home/andre/.nuget/
/home/andre/.nuget/plugins
/home/andre/.nuget/plugins/netcore
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/Newtonsoft.Json.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/NuGet.Common.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/unix
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/unix/lib
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/unix/lib/netstandard1.3
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.ProtectedData.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/win
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/win/lib
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/win/lib/netstandard1.3
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/runtimes/win/lib/netstandard1.3/System.Security.Cryptography.ProtectedData.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/NuGet.Packaging.Core.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.pdb
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.runtimeconfig.json
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/PowerArgs.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/NuGet.Configuration.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/Microsoft.IdentityModel.Clients.ActiveDirectory.Platform.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/Microsoft.IdentityModel.Clients.ActiveDirectory.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/NuGet.Packaging.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/NuGet.Versioning.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/NuGet.Frameworks.dll
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.deps.json
/home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/NuGet.Protocol.dll
/home/andre/.nuget/NuGet
/home/andre/.nuget/NuGet/NuGet.Config
@keithrob I have no credentials anywhere in nuget.config(s) - when I actually add PAT there, it works, but I assume it is not using the new plugin.
Running dotnet restore on my project fails with:
/opt/dotnet/sdk/2.1.402/NuGet.targets(114,5): error : Unable to load the service index for source https://sample.pkgs.visualstudio.com/_packaging/Official/nuget/v3/index.json. [/home/andre/projects/d365/deployment/src/DeploymentServices/DeployServices.sln]
/opt/dotnet/sdk/2.1.402/NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). [/home/andre/projects/d365/deployment/src/DeploymentServices/DeployServices.sln]
Then I manually run the plugin and it retrieves the token with manual authentication when calling directly:
dotnet /home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll -C -U https://sample.pkgs.visualstudio.com/_packaging/Official/nuget/v3/index.json -R
[Information] [CredentialProvider]Username: VssSessionToken
[Information] [CredentialProvider]Password: [REDACTED]
From verbose dotnet restore logs it shows the plugin is being loaded:
$ dotnet restore --interactive --verbosity diag
... (omitted some urls / paths)
Using /home/andre/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll as a credential provider plugin. (TaskId:38)
17:10:08.562 1>/opt/dotnet/sdk/2.1.401/NuGet.targets(114,5): error : Unable to load the service index for source ...
/opt/dotnet/sdk/2.1.401/NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). ...
NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://.....pkgs.visualstudio.com/_packaging/Official/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
So looks like the plugin works by itself, is being loaded by dotnet restore but for some reason does not provide the auth token to dotnet restore, even if I call it manually beforehand to cache the auth token.
Any other logs I could look into?
By any chance are you on a Mac? I have a similar issue, plus i also spotted some error complaining about culture parameter is required. I got mine working by setting the LANG=en_US for my environment variable
Apologies for the delay here. If you're still having issues, can you please post on Developer Community? That site is monitored by engineers and has a higher SLA for response.
@elbatk let's close this for now. There's an active feature internally (hoping to get to it next sprint) to provide much better docs for using the credential provider (including from w/in Docker, though that's not mentioned in this specific issue).
Thank you, all. Just wanted to provide closure. I tried it again on 2.2.100 and dotnet restore --interactive worked for me.
Most helpful comment
Thank you, all. Just wanted to provide closure. I tried it again on 2.2.100 and
dotnet restore --interactiveworked for me.