Skip to content

Nuget authentication rewrites the source keys of the nuget feeds if they are internal #402

@paule96

Description

@paule96

I have the following nuget config in my project:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<packageSources>
		<!--To inherit the global NuGet package sources remove the <clear/> line below -->
		<clear />
		<add key="nuget" value="https://api.nuget.org/v3/index.json" />
		<add key="privateFeed" value="https://pkgs.dev.azure.com/myfunnycompany/_packaging/myfunnycompany/nuget/v3/index.json" />
	</packageSources>
	<packageSourceMapping>
		<packageSource key="privateFeed">
			<package pattern="privatepackage.*" />
		</packageSource>
		<packageSource key="nuget">
			<package pattern="*" />
		</packageSource>
	</packageSourceMapping>
</configuration>

Local with a for expample dotnet restore it works. If I run it in azure devops I get the following error:

path/project.jscproj : error NU1100: Unable to resolve 'privatepackage.numberone (>= 0.1.1-15)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: , feed-privateFeed, nuget. [/path/solution.sln]

In my nuget config the feed is called privateFeed but in the error message feed-privateFeed. That will mean that the source mapping get's invalid.

The issue is produced in the following line:

For me their a two ways to fix the issue:

  • stop prefixing the feed.
    • on the current implementation are some nuget issues linked that are maybe important to solve that
  • make a string replace in the whole config that adds everywhere the prefix
    • this can be quite complecated because you want only replace sourcekey strings and not other substrings that have maybe the name letters but different meaning

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions