Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CredentialProvider in MSBuild Nuget Restore? #6609

Closed
Tadimsky opened this issue Feb 25, 2018 · 8 comments
Closed

CredentialProvider in MSBuild Nuget Restore? #6609

Tadimsky opened this issue Feb 25, 2018 · 8 comments
Labels
Area:Authentication Functionality:Restore Resolution:Duplicate This issue appears to be a Duplicate of another issue
Milestone

Comments

@Tadimsky
Copy link

Details about Problem

I have a project that has Nuget dependencies that are in our private feeds in VSTS. We have an issue where running Nuget restore via msbuild from the command line results in a 401 failure as it does not have credentials to access the feed.
We've been using this guide: https://docs.microsoft.com/en-us/vsts/package/nuget/bootstrap-nuget but this seems to only work if running nuget.exe and not Nuget as part of MSBuild.

Is there something we need to do for this to work correctly?

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): msbuild.exe on command line.

VS version (if appropriate): 15.5.7

OS version (i.e. win10 v1607 (14393.321)): 17107.1000

Detailed repro steps so we can see the same problem

  1. Run msbuild /t:Restore on a project that has Nuget dependencies with a feed that requires authentication

  2. Nuget invoked via MSBuild does not use the CredentialProvider that nuget.exe would normally use.

...

Other suggested things

Verbose Logs

Assembly = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Build.Tasks.dll
Parameters
 (in) RestoreGraphItems Count '4194'
 (in) RestoreDisableParallel 'False'
 (in) RestoreNoCache 'False'
 (in) RestoreIgnoreFailedSources 'False'
 (in) RestoreRecursive 'True'
 (in) RestoreForce 'False'
 (in) HideWarningsAndErrors 'False'
 Running restore with 4 concurrent jobs.
 Reading project file C:\Intentional\repo\src\A11Y\IDR.A11Y.HL\IDR.A11Y.HL.csproj.
 Reading project file C:\Intentional\repo\src\A11Y\IDR.A11Y.IOS\IDR.A11Y.IOS.csproj.
 Reading project file C:\Intentional\repo\src\A11Y\IDR.A11Y.Tests\IDR.A11Y.Tests.csproj.
 Reading project file C:\Intentional\repo\src\A11Y\IDR.A11Y.WD.Tests\IDR.A11Y.WD.Tests.csproj.
 Restoring packages for C:\Intentional\repo\src\A11Y\IDR.A11Y.WD.Tests\IDR.A11Y.WD.Tests.csproj...
 Restoring packages for C:\Intentional\repo\src\A11Y\IDR.A11Y.Tests\IDR.A11Y.Tests.csproj...
 The restore inputs for 'Microsoft.Intentional.IDR.A11Y.HL.Config.Debug' have changed. Continuing restore.
 Restoring packages for C:\Intentional\repo\src\A11Y\IDR.A11Y.HL\IDR.A11Y.HL.csproj...
 The restore inputs for 'Microsoft.Intentional.IDR.A11Y.IOS.Config.Debug' have changed. Continuing restore.
 Restoring packages for C:\Intentional\repo\src\A11Y\IDR.A11Y.IOS\IDR.A11Y.IOS.csproj...
 Restoring packages for .NETFramework,Version=v4.7...
 Restoring packages for .NETFramework,Version=v4.7...
 Restoring packages for .NETFramework,Version=v4.7...
 Restoring packages for .NETFramework,Version=v4.7...
   GET https://www.myget.org/F/vss-package-management/api/v2/FindPackagesById()?id='NUnit3TestAdapter'
   GET https://api.nuget.org/v3-flatcontainer/nunit3testadapter/index.json
 Resolving conflicts for .NETFramework,Version=v4.7...
 Resolving conflicts for .NETFramework,Version=v4.7...
 Restoring packages for UAP,Version=v10.0...
 Restoring packages for UAP,Version=v10.0...
   OK https://api.nuget.org/v3-flatcontainer/nunit3testadapter/index.json 252ms
   GET https://api.nuget.org/v3-flatcontainer/nunit3testadapter/3.9.0/nunit3testadapter.3.9.0.nupkg
   OK https://api.nuget.org/v3-flatcontainer/nunit3testadapter/3.9.0/nunit3testadapter.3.9.0.nupkg 232ms
   OK https://www.myget.org/F/vss-package-management/api/v2/FindPackagesById()?id='NUnit3TestAdapter' 1050ms
   GET https://microsoft.pkgs.visualstudio.com/_packaging/f7a4f8b6-c94b-4262-a054-1b9df4617cd6/nuget/v3/flat2/nunit3testadapter/index.json
   NotFound https://microsoft.pkgs.visualstudio.com/_packaging/f7a4f8b6-c94b-4262-a054-1b9df4617cd6/nuget/v3/flat2/nunit3testadapter/index.json 211ms
   GET https://ossmsft.pkgs.visualstudio.com/DefaultCollection/_packaging/4fb3f7f7-46a4-48be-852e-5aba811259c2/nuget/v3/flat2/nunit3testadapter/index.json
   OK https://ossmsft.pkgs.visualstudio.com/DefaultCollection/_packaging/4fb3f7f7-46a4-48be-852e-5aba811259c2/nuget/v3/flat2/nunit3testadapter/index.json 157ms
   GET https://api.nuget.org/v3-flatcontainer/microsoft.intentional.idr.cpp/index.json
   GET https://microsoft.pkgs.visualstudio.com/_packaging/f7a4f8b6-c94b-4262-a054-1b9df4617cd6/nuget/v3/flat2/microsoft.intentional.idr.cpp/index.json
   GET https://ossmsft.pkgs.visualstudio.com/DefaultCollection/_packaging/4fb3f7f7-46a4-48be-852e-5aba811259c2/nuget/v3/flat2/microsoft.intentional.idr.cpp/index.json
   GET https://www.myget.org/F/vss-package-management/api/v2/FindPackagesById()?id='Microsoft.Intentional.IDR.CPP'
 Restoring packages for UAP,Version=v10.0...
Errors
 NuGet.Protocol.Core.Types.FatalProtocolException: Unable to load the service index for source https://intentional.pkgs.visualstudio.com/_packaging/intent/nuget/v3/index.json. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).
   at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
   at NuGet.Protocol.HttpSource.<>c__DisplayClass12_0`1.<<GetAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Common.ConcurrencyUtilities.<ExecuteWithFileLockedAsync>d__2`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.HttpSource.<GetAsync>d__12`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.ServiceIndexResourceV3Provider.<GetServiceIndexResourceV3>d__9.MoveNext()
   --- End of inner exception stack trace ---
   at NuGet.Protocol.ServiceIndexResourceV3Provider.<GetServiceIndexResourceV3>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.ServiceIndexResourceV3Provider.<TryCreate>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.SourceRepository.<GetResourceAsync>d__16`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.SourceRepository.<GetResourceAsync>d__15`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.HttpFileSystemBasedFindPackageByIdResourceProvider.<TryCreate>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.SourceRepository.<GetResourceAsync>d__16`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.Core.Types.SourceRepository.<GetResourceAsync>d__15`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.SourceRepositoryDependencyProvider.<EnsureResource>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.SourceRepositoryDependencyProvider.<FindLibraryCoreAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.SourceRepositoryDependencyProvider.<>c__DisplayClass18_0.<<FindLibraryAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.SourceRepositoryDependencyProvider.<FindLibraryAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.DependencyResolver.ResolverUtility.<>c__DisplayClass7_1.<<FindLibraryFromSourcesAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.DependencyResolver.ResolverUtility.<FindLibraryFromSourcesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.DependencyResolver.ResolverUtility.<FindLibraryByVersionAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.DependencyResolver.ResolverUtility.<FindLibraryMatchAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.DependencyResolver.ResolverUtility.<FindLibraryEntryAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.DependencyResolver.RemoteDependencyWalker.<CreateGraphNode>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.DependencyResolver.RemoteDependencyWalker.<CreateGraphNode>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.ProjectRestoreCommand.<WalkDependenciesAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.Commands.ProjectRestoreCommand.<TryRestoreAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.Commands.RestoreCommand.<ExecuteRestoreAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at NuGet.Commands.RestoreCommand.<ExecuteAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.RestoreRunner.<ExecuteAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.RestoreRunner.<ExecuteAndCommitAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.RestoreRunner.<CompleteTaskAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.RestoreRunner.<RunAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Commands.RestoreRunner.<RunAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Build.Tasks.RestoreTask.<ExecuteAsync>d__31.MoveNext()
@nkolev92
Copy link
Member

Thanks for creating this issue.
Credentials providers are currently unsupported in MSBuild, but this is on our short term roadmap.
Issue here.

Currently the only alternative is storing your credentials in the NuGet.Config.

@nkolev92 nkolev92 added Resolution:Duplicate This issue appears to be a Duplicate of another issue Functionality:Restore Area:Authentication labels Feb 28, 2018
@nkolev92 nkolev92 added this to the 4.7 milestone Feb 28, 2018
@Tadimsky
Copy link
Author

Thanks @nkolev92 - so should we just use nuget.exe from the command line instead of msbuild until this work is done?

@nkolev92
Copy link
Member

nkolev92 commented Feb 28, 2018

@Tadimsky
Yep, that's the recommended approach for building with VSTS feeds right now.

By the above, I meant the only alternative for msbuild :)
I tunnel visioned myself into it :)

@jcagme
Copy link

jcagme commented Jun 12, 2019

In our build we end up doing running
dotnet msbuild /nologo -maxcpucount /m -verbosity:m /bl:.\Build.binlog /clp:Summary /logger:logger.dll /nr:False /p:ContinuousIntegrationBuild=True /p:TreatWarningsAsErrors=true /p:Configuration=Release /p:RepoRoot=. /p:Restore=True /p:DeployDeps=False /p:Build=True /p:Rebuild=False /p:Deploy=False /p:Test=True /p:Pack=True /p:IntegrationTest=False /p:PerformanceTest=False /p:Sign=True /p:Publish=True /p:Test=false /warnaserror \Build.proj

When it tries to restore the packages from the Azure feed we get a bunch of 401s:

C:\Program Files\dotnet\sdk\3.0.100-preview5-011568\NuGet.targets(121,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/*****/_packaging/****/nuget/v3/index.json.

To make sure I was indeed auth'ed I ran CredProvider in standalone dotnet c:\users\user\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll -U https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json -R -V Debug and got

[Verbose] [CredentialProvider]Running in stand-alone mode
[Verbose] [CredentialProvider]Command-line v0.1.17: c:\users\user\.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll -U https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json -R -V Debug
[Verbose] [CredentialProvider]Handling auth request, Uri: https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json, IsRetry: False, IsNonInteractive: False, CanShowDialog: False
[Verbose] [CredentialProvider]URI: https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]VstsBuildTaskServiceEndpointCredentialProvider - This credential provider must be run under the Team Build tasks for NuGet with external endpoint credentials. Appropriate environment variable needs to be set.
[Verbose] [CredentialProvider]Skipping NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider, cannot provide credentials for https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]VstsBuildTaskCredentialProvider - This credential provider must be run under the Team Build tasks for NuGet. Appropriate environment variables must be set.
[Verbose] [CredentialProvider]Skipping NuGetCredentialProvider.CredentialProviders.VstsBuildTask.VstsBuildTaskCredentialProvider, cannot provide credentials for https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]GET https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]IsRetry: False
[Verbose] [CredentialProvider]Could not find cached SessionToken for https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]GET https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]Found AAD Authority from 401 headers: https://login.windows.net/GUID
[Verbose] [CredentialProvider]VstsCredentialProvider - Using AAD authority: https://login.windows.net/GUID
[Verbose] [CredentialProvider]VstsCredentialProvider - Attempting to acquire bearer token using provider 'ADAL Cache'
[Verbose] [CredentialProvider]VstsCredentialProvider - Bearer token provider 'ADAL Cache' didn't acquire a token
[Verbose] [CredentialProvider]VstsCredentialProvider - Attempting to acquire bearer token using provider 'ADAL Windows Integrated Authentication'
[Information] [CredentialProvider]VstsCredentialProvider - Acquired bearer token using 'ADAL Windows Integrated Authentication'
[Information] [CredentialProvider]VstsCredentialProvider - Attempting to exchange the bearer token for an Azure DevOps session token.
[Verbose] [CredentialProvider]Requesting a SelfDescribing token valid for duration 04:00:00, valid until 6/12/2019 4:07:53 AM UTC. Note that the generated token may have different validity than requested.
[Verbose] [CredentialProvider]GET https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]VstsCredentialProvider - Found SessionToken for https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Verbose] [CredentialProvider]Caching SessionToken for https://pkgs.dev.azure.com/****/_packaging/****/nuget/v3/index.json
[Information] [CredentialProvider]Username: VssSessionToken
[Information] [CredentialProvider]Password: [REDACTED]

dotnet cli version is: 3.0.100-preview5-011568
msbuild version is: 16.1.19.19264

/fyi: @markwilkie

@nkolev92
Copy link
Member

@jcagme
The credential providers usually have special logic for their setup to run on the CIs.
Normally NuGet doesn't do much here.

@kzu
Copy link

kzu commented Jun 27, 2019

I would totally expect this to work. It makes the developer workflow much worse as it is, since now you need to know that depending on what's in a repository's nuget.config you can just do an msbuild restore, or you need to do a nuget restore, which also means you need to have nuget.exe in the path and so on. This is aggravated by submodules too, which can have arbitrary nesting levels and now you have no idea whether a msbuild /restore will ever work or not.

I'd just love to be able to tell users they just need to:

  1. Clone repo
  2. msbuild /restore

(2. would do restore, then build then maybe even test)

Done

@nkolev92
Copy link
Member

@kzu

Are you referring to the original ask or @jcagme's comment?

The original scenario now works.
With 15.9 and later, the Azure DevOps credential provider is always installed wherever NuGet is installed.
On the user machine, the user will get prompted to auth.

The CI scenario is different. No prompts/blocks are allowed, so the credential provider provide configurations to allow the skipping of the interactive step.

@kzu
Copy link

kzu commented Jun 29, 2019

Hm... we recently had to add a nuget restore [sln] (which works great) just because msbuild /t:restore [sln] didn't (in AzDO/DevDiv).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Authentication Functionality:Restore Resolution:Duplicate This issue appears to be a Duplicate of another issue
Projects
None yet
Development

No branches or pull requests

4 participants