sdk: Access denied for NuGet package source while build dotnet/cli 3.1.300 Tag
I’m trying to build version 3.1.300 of the dotnet/cli repository but the build.sh fails during the restore process with the following error message:
/build/cli/artifacts/toolset/restore.proj : error : Unable to load the service index for source https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-core-setup-0c2e69ca/nuget/v3/index.json.
100 | /build/cli/artifacts/toolset/restore.proj : error : Unable to load the service index for source https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-corefx-059a4a19/nuget/v3/index.json.
101
When I try to go directly to the URL for the package source I get access denied:
{"$id":"1","innerException":null,"message":"TF400813: The user 'Windows Live ID\\xxx@gmail.com' is not authorized to access this resource.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000}
The https://pkgs.dev.azure.com/dnceng/_packaging/darc-int-dotnet-core-setup-0c2e69ca/nuget/v3/index.json package source is coming from the NuGet.config file here https://github.com/dotnet/cli/blob/v3.1.300/NuGet.config
Why are the package source requiring authentication and how are automation machines not running in the .NET team’s build system supposed to be able to build the project if authentication is required.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 6
- Comments: 30 (29 by maintainers)
Seems like https://github.com/dotnet/cli/commit/7c1fa3d6c7ce4082a4c9974643536f821b91800c#diff-a7c26590e27fcbb61c69ff2564beb1fa changed the feeds from
darc-pub-dotnet-*todarc-int-dotnet-*, which I assume made them go from public to internal. As the change is made by @dotnet-bot, I can’t think of any other reason for this change than an oversight and that this must be a bug.Simply removing the internal feeds from
NuGet.configjust leads to a swath of other problems sayingSource control information is not available - the generated source link is empty. I don’t even know where to begin looking for the source of this problem, so some assistance would be helpful.Trying to build a version from before https://github.com/dotnet/cli/commit/7c1fa3d6c7ce4082a4c9974643536f821b91800c, such as v3.1.201, ends up printing an almost endless amount of the similar error message to the console:
Finally failing and halting on the following error:
Trying to access one of the faulty feeds ends up returning the following JSON-wrapped exception:
So currently, it seems impossible to build any version of .NET Core from source unless you’re hired by Microsoft and have access to their internal NuGet feeds. That’s very, very unfortunate. A fix would be highly appreciated. 🙏
With Homebrew/homebrew-core#60929 merged, this can be considered fixed for me at least.
Replied at https://github.com/dotnet/source-build/issues/1685#issuecomment-675476767.
Seen some build servers have an executable bash script in path named
dotnetthat sets up needed environment variables for that session only and passes along all arguments to “native” binary. Could that be a possibility?Using the SDK version is correct:
We have some info about packaging recommendations at https://docs.microsoft.com/en-us/dotnet/core/distribution-packaging, but it actually gets this specific piece of info wrong so I’ve filed https://github.com/dotnet/docs/pull/19921 to fix it.
To me, it feels like using the
dotnet/source-buildrepository for source builds is the best option. The only thing that seems to be missing is https://github.com/dotnet/source-build/issues/1646#issuecomment-668267153.Building the
sdkandclirepositories require too much source modifications and other local “hacks” in order to get the build to work and seems to go against the goals of the repositories. Since the goal of thesource-buildrepository is to provide source builds, that feels like the absolute best option to me.What I did to get around the issue was remove the internal darc feeds and the build worked fine for me afterwards. I would really like a better fix then me making changes to the repo before doing a build.
I was building in iTerm2, running
./build.sh --configuration Releaseon a downloaded.tar.gz, as that’s the preferable way to build from source in Homebrew. It’s possible to build from a cloned Git repository, but that means the formula becomes “head only” and has to be installed with the--HEADargument. I’m not yet sure how it will affect dependent formulae, but it doesn’t sound like the recommended path to take.There is another option:
https://github.com/NuGet/Home/issues/9765
The downside of SetupNuGetSources.ps1 is: