Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

NuGet.Config with private sources is not using #1035

Open
ykysel opened this issue Sep 8, 2020 · 9 comments
Open

NuGet.Config with private sources is not using #1035

ykysel opened this issue Sep 8, 2020 · 9 comments

Comments

@ykysel
Copy link

ykysel commented Sep 8, 2020

Hi.
I'm trying to use version 0.33.0 and can not work with private sources.
Sources are added but not in use (see below). Is this mine configuration problem or bug?

E:\Agent\1\externals\git\cmd\git.exe config --global user.name NuKeeper
E:\Agent\1\externals\git\cmd\git.exe config --global user.email [email protected]
Found tool in cache: nukeeper 0.33.0 x64
e:\a\1_tool\nukeeper\0.33.0\x64\NuGet.exe sources add -name projectScoped -source -username nukeeper -password *** -configFile e:\a\1\9\NuGet.config
Package source with Name: projectScoped added successfully.
e:\a\1_tool\nukeeper\0.33.0\x64\NuGet.exe sources add -name organisationalScoped -source -username nukeeper -password *** -configFile e:\a\1\9\NuGet.config
Package source with Name: organisationalScoped added successfully.

"C:\Program Files\dotnet\dotnet.exe" e:\a\1_tool\nukeeper\0.33.0\x64\NuKeeper.dll repo e:\a\1\9\s\src *** --targetBranch origin/play-with-nukeeper -a 0 -m 100 -c minor -n --useprerelease Never -v D -f SingleRepositoryOnly --include ^.
Matched uri '' to collaboration platform 'AzureDevOps'
FindPushFork. Fork Mode is SingleRepositoryOnly
2020-09-08T10:29:13Z: Started
GetGitRepositories: Requesting /_apis/git/repositories?api-version=4.1
Using upstream fork as push, for project at
User name missing from profile, falling back to .gitconfig
Git clone , branch default, to C:\Users\svcAzureDevOpsBuild\AppData\Local\Temp\NuKeeper\repo-0753d7e180ea45f0a61f14f326c79b08
0 / 360
36 / 360
72 / 360
108 / 360
144 / 360
180 / 360
216 / 360
252 / 360
288 / 360
324 / 360
360 / 360
Git clone complete
Reading file C:\Users\svcAzureDevOpsBuild\AppData\Roaming\NuGet\NuGet.Config for package sources
Reading file C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config for package sources
Reading file C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config for package sources
Read [nuget.org] : https://api.nuget.org/v3/index.json from file:
Read [Microsoft Visual Studio Offline Packages] : file:///C:/Program Files (x86)/Microsoft SDKs/NuGetPackages/ from file: C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Found 15 packages
....

@ykysel
Copy link
Author

ykysel commented Sep 8, 2020

So, I moved NuGet.Config to the root of repository. Now it's using sources, but throw an error when trying to authenticate it (I use private sources).
@skolima @AnthonySteele, could you advice me what I need to do? Add Credentials to NuGet.Config? What if I do not use NuGet.Config and just add source as an argument (--source https://....)?

Using C:\Users\svcAzureDevOpsBuild.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll as a credential provider plugin.
Problem starting the plugin 'C:\Users\svcAzureDevOpsBuild.nuget\plugins\netcore\CredentialProvider.Microsoft\CredentialProvider.Microsoft.dll'. Cannot start process because a file name has not been provided.
System.InvalidOperationException: Cannot start process because a file name has not been provided.
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)

@CrispyDrone
Copy link
Contributor

Yes, since version 3.4 (?) of nuget cli demands that the NuGet.config is at the root of the repository, you can read more about this here.

You can use credentials in nuget.config or credential providers, maybe the following links can help you:

I'm not sure how this works with multiple sources, I haven't had to configure something like this myself.

@Bouke
Copy link
Contributor

Bouke commented Jan 25, 2021

NuGet 3.4 requires NuGet.config in the solution root, which can be different from repository root in for example repositories with multiple solutions. For example I have the following structure:

.
├── README.md
└── Sources
    ├── MySolution.sln
    └── NuGet.Config

How can I instruct NuKeeper to work from the Sources/ directory? This is the log output:

Reading file C:\Users\VssAdministrator\AppData\Roaming\NuGet\NuGet.Config for package sources
Reading file C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config for package sources
Reading file C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config for package sources

Update Running with the --sources argument doesn't appear to be working:

##[debug]nukeeper repo D:\a\1\s *** --source Source\NuGet.config --targetBranch master --exclude "^(System\.|EO\.Pdf$)" --change minor --age 3w --branchnametemplate "nukeeper/{default}" -v d'
Found 325 packages
Filtered by Exclude '^(System\.|EO\.Pdf$)' from 325 to 312
Found 312 packages in use, 84 distinct, in 51 projects.
Found 0 possible updates
Output report named XXX, is Text to Console
Found no package updates
Wrote report for 0 updates
No potential updates found. Well done. Exiting.

Most of those 51 packages are outdated. The NuGet.config provided by my repository only adds our custom source and is supposed to supplement the host's configuration (which should be providing nuget.org):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="XXX" value="https://pkgs.dev.azure.com/XXX/_packaging/XXX/nuget/v3/index.json" />
    </packageSources>
</configuration>

However after writing a custom NuGet.config as part of the build and referencing it directly, the output is the same (0 updates):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <clear />
        <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
        <add key="XXX" value="https://pkgs.dev.azure.com/XXX/_packaging/XXX/nuget/v3/index.json" />
    </packageSources>
</configuration>
nukeeper repo D:\a\1\s *** --source D:\a\1\s\NuGet.config --targetBranch master --exclude "^(System\.|EO\.Pdf$)" --change minor --age 3w --branchnametemplate "nukeeper/{default}" -v d'
Found 325 packages
Filtered by Exclude '^(System\.|EO\.Pdf$)' from 325 to 312
Found 312 packages in use, 84 distinct, in 51 projects.
...
Found 0 possible updates
Output report named XXX, is Text to Console
Found no package updates
Wrote report for 0 updates
No potential updates found. Well done. Exiting.

@stale
Copy link

stale bot commented Apr 25, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 25, 2021
@Bouke
Copy link
Contributor

Bouke commented Apr 25, 2021

@stale stale bot removed the wontfix label Apr 25, 2021
@stale
Copy link

stale bot commented Jul 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 24, 2021
@Bouke
Copy link
Contributor

Bouke commented Jul 25, 2021

I’d like to keep this issue open.

@stale stale bot removed the wontfix label Jul 25, 2021
@stale
Copy link

stale bot commented Oct 23, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 23, 2021
@Bouke
Copy link
Contributor

Bouke commented Oct 23, 2021

I’d like to keep this issue open.

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

No branches or pull requests

3 participants