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

Not able to run a project referencing to private nuget package #1358

Open
kesiyaabraham opened this issue Jan 22, 2020 · 12 comments
Open

Not able to run a project referencing to private nuget package #1358

kesiyaabraham opened this issue Jan 22, 2020 · 12 comments

Comments

@kesiyaabraham
Copy link

I have a project which has a dependency on Azure functions, class libraries and private NuGet packages.

I am trying to benchmark a method inside a service class. But I am getting the below error

 Build Exception: C:\Program Files\dotnet\sdk\3.1.100\NuGet.targets(123,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/.../index.json. [C:\..\Benchmarking\bin\Release\netcoreapp2.1\e50243bd-a276-4e7c-b2bc-33b3959a1b2c\BenchmarkDotNet.Autogenerated.csproj]
C:\Program Files\dotnet\sdk\3.1.100\NuGet.targets(123,5): error :   Response status code does not indicate success: 401 (Unauthorized). [C:\..\Benchmarking\bin\Release\netcoreapp2.1\e50243bd-a276-4e7c-b2bc-33b3959a1b2c\BenchmarkDotNet.Autogenerated.csproj]

I am not sure why this error is happening as we are taking nuget packages from cache when running a project.

Please let me know if you need more information on the project or error.

@frankhaugen
Copy link

I am also experiencing this exact issue

@adamsitnik
Copy link
Member

I won't have time to take a look at this in the near future.

It would be great if you could run some troubleshooting described here: https://benchmarkdotnet.org/articles/guides/troubleshooting.html

It's really strange that BDN fails, as all it does is generating a new project that references the project with benchmarks and running dotnet restore in its folder...

@eginsjd
Copy link

eginsjd commented Nov 26, 2021

I have the same problem. I'm trying to run BDN on azure pipelines but the main project has a reference to a package from a private source.
Is there a solution for this? Or, is there a way to run bechmarkRunner without the dotnet restore command?

@boblaw99
Copy link

boblaw99 commented Dec 5, 2021

Same here. Only happend on Linux and use sudo command.
If not use sudo command, then it will be fine, except have a message:
Failed to set up high priority. Make sure you have the right permissions. Message: Permission denied

@eginsjd
Copy link

eginsjd commented Dec 5, 2021

Yes I was able to solve the problem by disabling the private sources (dotnet nuget disable [sourceName]) right before running BDN. But I get the same warning.

@jrodrigv
Copy link

I'm also suffering from this issue. It is like the dotnet restore executed it is not using the nuget.config (in which the credentials are defined) to perform the nuget restore. I tried to copy inside my BDN project the Nuget.Config but no luck so far. I will take a lot to the code to see if I find a way to fix it

@jrodrigv
Copy link

jrodrigv commented Jan 23, 2023

Ok I have found a way to avoid this error and it is simple.
If you are using private nugets feeds you would have a NuGet.config in your solution folder, add as link that file inside your benchmark project folder and set the properties of the file to "Content" and "Copy Always". After that the dotnet restore should work just fine.

@adamsitnik
Copy link
Member

@jrodrigv thanks for sharing!

@JobaDiniz
Copy link
Contributor

Is @jrodrigv workaround suffice or BenchmarkDotNet team is looking for a solution? Or maybe documentation? Please let me know so I can grab this issue to try fixing it.

@AndreyAkinshin
Copy link
Member

@JobaDiniz, Thank you for your interest in this issue and for offering your help. I believe we should start with a stable repro for this problem. I just tried to reproduce it myself with BenchmarkDotNet v0.13.5, but everything works fine out of the box. Since BenchmarkDotNet creates an autogenerated project in a subfolder of the original project, it inherits all the relevant NuGet.Config files with all the declared credentials.

@kesiyaabraham @frankhaugen @eginsjd @boblaw99 @jrodrigv If the issue is still relevant for you, we would appreciate any additional details on how you configure your benchmarks.

@amazingalek
Copy link

amazingalek commented Mar 10, 2024

I'm also getting this issue. I've tried @jrodrigv's workaround but it doesn't help. Rebuilding the benchmark project fixes it, but I gotta do it pretty often, it's a bit annoying.

@timcassell
Copy link
Collaborator

@amazingalek Can you please share how to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants