BenchmarkDotNet
BenchmarkDotNet copied to clipboard
Not able to run a project referencing to private nuget package
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.
I am also experiencing this exact issue
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...
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?
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
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.
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
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.
@jrodrigv thanks for sharing!
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.
@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.
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.
@amazingalek Can you please share how to reproduce?