You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot connect to a private nuget server (Azure DevOps) #59
I have tried to run dotnet outdated but it does not work on my computer.
I have dotnet SDK 5.0.100 and the latest version of the tool 3.1.0. I also have the latest version of Microsoft.NuGet.CredentialProvider
Errors occurred while analyzing dependencies for some of your projects. Are you sure you can connect to all your configured NuGet servers?
Unable to find DOTNET_HOST_PATH environment variable. If you use credential providers for your NuGet sources you need to have this set to the path to the dotnet executable.
I can set manually DOTNET_HOST_PATH but it still cannot connect to my private nuget source server :
Errors occurred while analyzing dependencies for some of your projects. Are you sure you can connect to all your configured NuGet servers?
Nuget server was added with the dotnet nuget add source command (with username and PAT token as password).
The dotnet command dotnet list package --outdated works well.
Reacted by Danny Warren, AraHaan, Mike Goatly, Terje Hoås, Victor Irzak and Nikola Malovic
We are in the same boat. It seems that dotnet outdated is not using our configured Azure Artifacts credential provider to access our private NuGet feed in Azure DevOps.
Does it work if you first run the Azure DevOps dotnet restore step? I think there might be some special stuff to make the token available to the restore step that might not be available when running dotnet outdated.
Running `dotnet restore` first does not seem to solve our problem :(
Danny Warren | Sr. Software Engineer | Emmersion Learning | Mobile:
801.473.5073 | @dannydwarren
I was able to use the Nuget Authenticate task before it in order to get things working again. My issue seemed to be that dotnet-outdated-tool doesn't appear to read the credentials used elsewhere in the pipeline.
Can anyone else confirm this fixes the issue for them as well? There is some funky stuff that goes on in Azure DevOps pipelines with service principals and authentication.
Although I think the initial issue was when running this locally, not in Azure DevOps pipelines. @adrien-constant can you confirm? Don't want to prematurely close this issue.
Here's what worked for me (in a local setting, not in a pipeline):
Definitely use the Azure Artifacts credential provider, but...
Don't use "dotnet restore --interactive" to get the credentials into it during a restore, but rather....
Run the credentials provider manually (dotnet run .\pathToThePluginFolder\CredentialProvider.Microsoft.dll -U yourArtifactsUri -C). More info on the parameters here (in the help section).
Make peace with the fact that more than one token might be requested
While before, dotnet restore would regularly forget any credentials, they seem to be stored for good now.
The problem still occurs in Azure Pipelines.
I have also tried, as suggested by @PartTimeLegend to add the Nuget Authenticate step before this but I keep getting the following error for my private feeds in Azure Devops:
Errors occurred while analyzing dependencies for some of your projects. Are you sure you can connect to all your configured NuGet servers?
Unable to find DOTNET_HOST_PATH environment variable. If you use credential providers for your NuGet sources you need to have this set to the path to the `dotnet` executable.
My yaml file consists of the following:
Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: ubuntu-latest
steps:
- task: UseDotNet@2
inputs:
version: "6.x"
- task: UseDotNet@2
inputs:
version: "3.x"
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
projects: '*/**.csproj'
feedsToUse: 'select'
vstsFeed: '<nuget-feed-id>'
- script: dotnet tool install -g dotnet-outdated-tool
- task: DotNetCoreCLI@2
inputs:
command: 'custom'
projects: '*/**.csproj'
custom: 'outdated'
arguments: '--fail-on-updates --older-than 14'
The problem still occurs in Azure Pipelines. I have also tried, as suggested by @PartTimeLegend to add the Nuget Authenticate step before this but I keep getting the following error for my private feeds in Azure Devops:
Errors occurred while analyzing dependencies for some of your projects. Are you sure you can connect to all your configured NuGet servers?
Unable to find DOTNET_HOST_PATH environment variable. If you use credential providers for your NuGet sources you need to have this set to the path to the `dotnet` executable.
Any suggestions on how to fix this?
On my private vsts agent, dotnet executable is located under /usr/bin/dotnet
So you may be able to hard set the env variable, that should fix it.
I have the same issue (tool not working locally, never mind Azure Pipelines...).
I verified I'm using dotnet-outdated-tool version 4.3.2 (latest).
I followed @danielcweber's steps to get the credentials going.
I verified that I'm able to connect to all my configured NuGet servers.
For example, dotnet list package --outdated works.
Just like pretty much everyone else here, I'm getting the following error:
Errors occurred while analyzing dependencies for some of your projects. Are you sure you can connect to all your configured NuGet servers?
It would be really, really helpful if dotnet-outdated had some sort of --verbose parameter that allowed us to see the underlying errors, so we at least have a chance of figuring out what's wrong.
create a user with read-only access to the nuget feed.
create an access token (with the longest possible ttl)
create a nuget.config in your repo leveraging the access token like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- add this line to override previously accumulated sources (e.g. from nuget.config(s) in parent directories)-->
<clear />
<addkey="nuget.org"value="https://api.nuget.org/v3/index.json" />
<!-- reference to your nuget feed -->
<addkey="MyFeed"value="https://path-to-feed.com/index.json" />
</packageSources>
<packageSourceCredentials>
<!-- credentials to our nuget feed -->
<MyFeed>
<!-- username required for authentication type. can be arbitrary but not empty -->
<addkey="Username"value="user" />
<!-- password is PAT for the created user -->
<addkey="ClearTextPassword"value="ecampleAccesToken123" />
<addkey="ValidAuthenticationTypes"value="basic" />
</MyFeed>
</packageSourceCredentials>
</configuration>
This way the credentials provider is never needed. Sure it's not the best possible solution but it works for now.
@LucidoKeith I had the same issue, below is the stacktrace I encountered. For me the problem was the DOTNET_HOST_PATH environment variable pointing to the wrong location. In my case setting the value to C:\Program Files\dotnet\dotnet.exe fixed the access denied issue.
In Program.Cs this line can be changed to use a real logger instead of a nulllogger so that the user is at least aware of issues.
I'll see if I can create a PR to improve the logging.
System.ComponentModel.Win32Exception (5): An error occurred trying to start process 'C:\Program Files\dotnet\sdk\7.0.306' with working directory 'C:\Users\C91412\Developer\Workspace\us\XXXXX'. Access is denied.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at NuGet.Protocol.Plugins.PluginProcess.Start()
at NuGet.Protocol.Plugins.PluginFactory.CreatePluginAsync(String filePath, IEnumerable1 arguments, IRequestHandlers requestHandlers, ConnectionOptions options, CancellationToken sessionCancellationToken) at NuGet.Protocol.Plugins.PluginFactory.GetOrCreateAsync(String filePath, IEnumerable1 arguments, IRequestHandlers requestHandlers, ConnectionOptions options, CancellationToken sessionCancellationToken)
at NuGet.Protocol.Plugins.PluginManager.TryCreatePluginAsync(PluginDiscoveryResult result, OperationClaim requestedOperationClaim, PluginRequestKey requestKey, String packageSourceRepository, JObject serviceIndex, CancellationToken cancellationToken)
I have run into this issue as well trying to get this to run in devops pipeline. Creating a nuget.config to all my repos with PATS is too much hassle and bad practice. Nothing else seem to work.
Here in 2024, and none of these workarounds have worked for me.
It's clear that changes to the tool are needed to support using with Private NuGet Feeds from Azure DevOps.
I think the PR #493 could be rebased and adjusted to work in main again. This would at least give some logging to show exactly what is failing. For me, it runs locally, but not inside the pipeline and I have absolutely no idea why.
I'm going to dive into the code a bit more tomorrow, and see if I can get a custom build running in the pipeline with better logging. If I find anything I will add it here.
Hello all, I'm back with a PR to add logging, and the error that is causing it to not work in Azure DevOps for me.
The PR
A more polished version of the original Logging PR #493 which hopefully will get approved. If you are still stuck yourselves, please consider giving it a Thumbs Up! 👍
If you want to run my version of the code in your own pipelines, it's a bit of a pain, but it can be done.
Build for your Agent's OS (mine was ubuntu) and zip it (I chose .tar.gz, but you can use .zip if you like)
In the pipeline, extract that archive into a folder, I chose the Built-in ToolsDirectory.
Then call the executable directly. I had to run chmod to make it executable. I used Bash because I had issues with Powershell on Ubuntu, but whatever works for you.
[ERROR] Problem starting the plugin '/home/vsts/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll'. The FileName property should not be a directory unless UseShellExecute is set.
I have absolutely no idea what it means, but maybe someone here can help me. Either way, it's a step in the right direction!
Just a heads up for anyone that ends up here like I did trying to debug this error message.
In my case, it was due to my nuget.config file being in a sub-folder and not the root folder of my source ie with other dotnet commands and tools I was specifying the config or the config wasn't required so I didn't think of this as being my issue at first. Once I moved it, my self-hosted build agent was able to run the tool just fine.
Ideally this tool would allow us to specify the path to the config file but it's not a huge deal for me to move it and now everything is working well.
So, spent a significant amount of time today looking into this again.... and still no luck.
From your comment @jvgarner, I tried moving my nuget.config file around to different places in the hope it was that but still had no luck. So I actually built my own version of dotnet-outdated that allowed me to specify the nuget.config I want to use (yes, I will raise a PR with my changes soon, leave a 👍 to hold me accountable for that). However, even when specifying the nuget.config file directly, it still failed with the same error.
[DEBUG] Using /home/vsts/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll as a credential provider plugin.
[ERROR] Problem starting the plugin '/home/vsts/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll'. The FileName property should not be a directory unless UseShellExecute is set.
[DEBUG] System.ComponentModel.Win32Exception (0x80004005): The FileName property should not be a directory unless UseShellExecute is set.
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at NuGet.Protocol.Plugins.PluginProcess.Start()
at NuGet.Protocol.Plugins.PluginFactory.CreatePluginAsync(String filePath, IEnumerable`1 arguments, IRequestHandlers requestHandlers, ConnectionOptions options, CancellationToken sessionCancellationToken)
at NuGet.Protocol.Plugins.PluginFactory.GetOrCreateAsync(String filePath, IEnumerable`1 arguments, IRequestHandlers requestHandlers, ConnectionOptions options, CancellationToken sessionCancellationToken)
at NuGet.Protocol.Plugins.PluginManager.TryCreatePluginAsync(PluginDiscoveryResult result, OperationClaim requestedOperationClaim, PluginRequestKey requestKey, String packageSourceRepository, JObject serviceIndex, CancellationToken cancellationToken)
I did an ls inside the CredentialProvider.Microsoft folder, and the files are there, so I have absolutely no idea what's going on. One thing that occurred to me is that I am using ubuntu-latest, and I wonder if this is some Windows pathing issue. Still super weird as the task before this literally does a dotnet restore so it can definitely work.
Has anyone got theirs working on Linux with a private nuget server?
Essentially I did what @polferov posted, and added credentials into the config file and that seemed to work. I have no idea why the credential provider doesn't work, but I have found a slightly easier way to do this in Azure DevOps now.
The NuGetAuthenticate@1 task adds the VSS_NUGET_ACCESSTOKEN environment variable for the rest of the job (source), so I use that as my access token in the config file using the % characters (source).
I'm still going to submit my PR for the "Specify NuGet config" change, in case you want a different nuget.config for pipelines than for devs locally. I might also create a new formatter that looks better in Azure DevOps as currently the colouring formatting doesn't work.
I've spent 6 hours trying to figure out how to solve this, including creating Nuget.
I configured it with hardcoded PAT and other advice here, and all I achieved was a supreme level of furiousness that something so essential as "update all packages with CLI" in dotnet 2024 is still a challenge...
I am going to try to do this now manually using standard dotnet clicli and powershell
feature request/suggestion: potentially log the specific projects/nugets it has Unknown dependency upgrade severity for?
I was running into the same issue locally as others have described above (dealing with private nuget feed etc.), however when cloning the repo and debugging against Sln path I am trying to execute dotnet outdated against, I actually then did not get this error; so it seems impossible for me to further troubleshoot what particular packages it is complaining about internally.
maybe could provide as default option or flag to selectively log around these
Activity
dannydwarren commentedon Jan 11, 2021
We are in the same boat. It seems that
dotnet outdatedis not using our configured Azure Artifacts credential provider to access our private NuGet feed in Azure DevOps.coderpatros commentedon Jan 13, 2021
Does it work if you first run the Azure DevOps
dotnet restorestep? I think there might be some special stuff to make the token available to the restore step that might not be available when runningdotnet outdated.dannydwarren commentedon Jan 17, 2021
Spragalas commentedon May 31, 2021
Did anyone found the solution? I am currently experiencing same issue
PartTimeLegend commentedon Jun 4, 2021
I'm also in the same boat. Is this project abandoned?
coderpatros commentedon Jun 4, 2021
Not abandoned. Just an issue I haven't faced myself. And just one issue in a long list of the projects I work on.
If someone wants to debug this, and come up with a solution, a pull request would be most appreciated.
PartTimeLegend commentedon Jun 6, 2021
I was able to use the Nuget Authenticate task before it in order to get things working again. My issue seemed to be that dotnet-outdated-tool doesn't appear to read the credentials used elsewhere in the pipeline.
coderpatros commentedon Jun 7, 2021
Can anyone else confirm this fixes the issue for them as well? There is some funky stuff that goes on in Azure DevOps pipelines with service principals and authentication.
Although I think the initial issue was when running this locally, not in Azure DevOps pipelines. @adrien-constant can you confirm? Don't want to prematurely close this issue.
danielcweber commentedon Jul 21, 2021
Here's what worked for me (in a local setting, not in a pipeline):
While before, dotnet restore would regularly forget any credentials, they seem to be stored for good now.
adrien-constant commentedon Dec 21, 2021
For information, it worked after upgrading to the latest version and login interactively with the browser :
dotnet tool update --global dotnet-outdated-tool --interactive --verbosity minimalLotteVoorhorst commentedon Jan 4, 2022
The problem still occurs in Azure Pipelines.
I have also tried, as suggested by @PartTimeLegend to add the Nuget Authenticate step before this but I keep getting the following error for my private feeds in Azure Devops:
My yaml file consists of the following:
Any suggestions on how to fix this?
adrien-constant commentedon Jan 4, 2022
On my private vsts agent, dotnet executable is located under
/usr/bin/dotnetSo you may be able to hard set the env variable, that should fix it.
RudeySH commentedon Dec 20, 2022
I have the same issue (tool not working locally, never mind Azure Pipelines...).
dotnet list package --outdatedworks.Just like pretty much everyone else here, I'm getting the following error:
It would be really, really helpful if dotnet-outdated had some sort of
--verboseparameter that allowed us to see the underlying errors, so we at least have a chance of figuring out what's wrong.polferov commentedon Feb 10, 2023
The workaround i found was to:
This way the credentials provider is never needed. Sure it's not the best possible solution but it works for now.
ivog commentedon Oct 24, 2023
@LucidoKeith I had the same issue, below is the stacktrace I encountered. For me the problem was the DOTNET_HOST_PATH environment variable pointing to the wrong location. In my case setting the value to C:\Program Files\dotnet\dotnet.exe fixed the access denied issue.
In Program.Cs this line can be changed to use a real logger instead of a nulllogger so that the user is at least aware of issues.
DefaultCredentialServiceUtility.SetupDefaultCredentialService(new NuGet.Common.NullLogger(), true);I'll see if I can create a PR to improve the logging.
System.ComponentModel.Win32Exception (5): An error occurred trying to start process 'C:\Program Files\dotnet\sdk\7.0.306' with working directory 'C:\Users\C91412\Developer\Workspace\us\XXXXX'. Access is denied.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at NuGet.Protocol.Plugins.PluginProcess.Start()
at NuGet.Protocol.Plugins.PluginFactory.CreatePluginAsync(String filePath, IEnumerable
1 arguments, IRequestHandlers requestHandlers, ConnectionOptions options, CancellationToken sessionCancellationToken) at NuGet.Protocol.Plugins.PluginFactory.GetOrCreateAsync(String filePath, IEnumerable1 arguments, IRequestHandlers requestHandlers, ConnectionOptions options, CancellationToken sessionCancellationToken)at NuGet.Protocol.Plugins.PluginManager.TryCreatePluginAsync(PluginDiscoveryResult result, OperationClaim requestedOperationClaim, PluginRequestKey requestKey, String packageSourceRepository, JObject serviceIndex, CancellationToken cancellationToken)
RecTuomas commentedon Dec 19, 2023
I have run into this issue as well trying to get this to run in devops pipeline. Creating a nuget.config to all my repos with PATS is too much hassle and bad practice. Nothing else seem to work.
Chris-Greaves commentedon May 3, 2024
Here in 2024, and none of these workarounds have worked for me.
It's clear that changes to the tool are needed to support using with Private NuGet Feeds from Azure DevOps.
I think the PR #493 could be rebased and adjusted to work in main again. This would at least give some logging to show exactly what is failing. For me, it runs locally, but not inside the pipeline and I have absolutely no idea why.
I'm going to dive into the code a bit more tomorrow, and see if I can get a custom build running in the pipeline with better logging. If I find anything I will add it here.
Chris-Greaves commentedon May 30, 2024
Hello all, I'm back with a PR to add logging, and the error that is causing it to not work in Azure DevOps for me.
The PR
A more polished version of the original Logging PR #493 which hopefully will get approved. If you are still stuck yourselves, please consider giving it a Thumbs Up! 👍
If you want to run my version of the code in your own pipelines, it's a bit of a pain, but it can be done.
.tar.gz, but you can use.zipif you like)chmodto make it executable. I used Bash because I had issues with Powershell on Ubuntu, but whatever works for you.The Error
Using the logging, I got the error below:
I have absolutely no idea what it means, but maybe someone here can help me. Either way, it's a step in the right direction!
jvgarner commentedon Jun 29, 2024
Just a heads up for anyone that ends up here like I did trying to debug this error message.
In my case, it was due to my nuget.config file being in a sub-folder and not the root folder of my source ie with other dotnet commands and tools I was specifying the config or the config wasn't required so I didn't think of this as being my issue at first. Once I moved it, my self-hosted build agent was able to run the tool just fine.
Ideally this tool would allow us to specify the path to the config file but it's not a huge deal for me to move it and now everything is working well.
Chris-Greaves commentedon Aug 22, 2024
So, spent a significant amount of time today looking into this again.... and still no luck.
From your comment @jvgarner, I tried moving my nuget.config file around to different places in the hope it was that but still had no luck. So I actually built my own version of dotnet-outdated that allowed me to specify the nuget.config I want to use (yes, I will raise a PR with my changes soon, leave a 👍 to hold me accountable for that). However, even when specifying the nuget.config file directly, it still failed with the same error.
I did an
lsinside theCredentialProvider.Microsoftfolder, and the files are there, so I have absolutely no idea what's going on. One thing that occurred to me is that I am using ubuntu-latest, and I wonder if this is some Windows pathing issue. Still super weird as the task before this literally does adotnet restoreso it can definitely work.Has anyone got theirs working on Linux with a private nuget server?
Chris-Greaves commentedon Sep 5, 2024
Alright, I got it working finally!!!
Essentially I did what @polferov posted, and added credentials into the config file and that seemed to work. I have no idea why the credential provider doesn't work, but I have found a slightly easier way to do this in Azure DevOps now.
My pipeline tasks:
My nuget.config:
The
NuGetAuthenticate@1task adds theVSS_NUGET_ACCESSTOKENenvironment variable for the rest of the job (source), so I use that as my access token in the config file using the%characters (source).I'm still going to submit my PR for the "Specify NuGet config" change, in case you want a different nuget.config for pipelines than for devs locally. I might also create a new formatter that looks better in Azure DevOps as currently the colouring formatting doesn't work.
I hope someone reads this and finds it helpful.
malovicn commentedon Oct 18, 2024
I've spent 6 hours trying to figure out how to solve this, including creating Nuget.
I configured it with hardcoded PAT and other advice here, and all I achieved was a supreme level of furiousness that something so essential as "update all packages with CLI" in dotnet 2024 is still a challenge...
I am going to try to do this now manually using standard dotnet clicli and powershell
dylbarne commentedon Nov 4, 2024
feature request/suggestion: potentially log the specific projects/nugets it has Unknown dependency upgrade severity for?
I was running into the same issue locally as others have described above (dealing with private nuget feed etc.), however when cloning the repo and debugging against Sln path I am trying to execute
dotnet outdatedagainst, I actually then did not get this error; so it seems impossible for me to further troubleshoot what particular packages it is complaining about internally.maybe could provide as default option or flag to selectively log around these