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

nuget.config file w\o any nuget sources in $env:APPDATA\NuGet\ after invoking any choco command #23

Closed
gep13 opened this issue May 5, 2021 · 1 comment · Fixed by #24
Assignees
Labels

Comments

@gep13
Copy link
Member

gep13 commented May 5, 2021

What You Are Seeing?

We maintain GitHub actions runners and receive an issue about resolving packages from Nuget.or recently actions/runner-images#3038
It turned out that after invoking any choco command a nuget.config file is created in $env:APPDATA\NuGet\ and this file doesn't contain any NuGet package sources, which leads to msbuild failures because nuget currently respects user-wide config file — NuGet/NuGet.Client#3907 and there is no available sources in the file, created by choco.

$env:APPDATA\NuGet\nuget.config content:

<?xml version="1.0" encoding="utf-8"?>
<configuration />

What is Expected?

$env:APPDATA\NuGet\nuget.config file is not created

How Did You Get This To Happen? (Steps to Reproduce)

gci $env:APPDATA\NuGet\
choco version
gci $env:APPDATA\NuGet\
gc $env:APPDATA\NuGet\nuget.config

Output Log

Full Log Output

```
2021-04-15 11:36:33,533 5156 [DEBUG] - XmlConfiguration is now operational
2021-04-15 11:36:33,611 5156 [INFO ] - ============================================================
2021-04-15 11:36:33,970 5156 [INFO ] - Chocolatey v0.10.15
2021-04-15 11:36:33,977 5156 [DEBUG] - Chocolatey is running on Windows v 10.0.17763.0
2021-04-15 11:36:33,979 5156 [DEBUG] - Attempting to delete file "C:/ProgramData/Chocolatey/choco.exe.old".
2021-04-15 11:36:33,980 5156 [DEBUG] - Attempting to delete file "C:\ProgramData\Chocolatey\choco.exe.old".
2021-04-15 11:36:34,042 5156 [DEBUG] - Command line: "C:\ProgramData\Chocolatey\choco.exe" version
2021-04-15 11:36:34,043 5156 [DEBUG] - Received arguments: version
2021-04-15 11:36:34,107 5156 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2021-04-15 11:36:34,117 5156 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2021-04-15 11:36:34,130 5156 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2021-04-15 11:36:40,224 5156 [DEBUG] - Performing validation checks.
2021-04-15 11:36:40,225 5156 [WARN ] - 
DEPRECATION NOTICE - choco version command is deprecated and will be 
 removed in version 1.0.0. Please use `choco upgrade pkgname --noop` 
 instead.
2021-04-15 11:36:40,230 5156 [DEBUG] - Global Configuration Validation Checks:
2021-04-15 11:36:40,232 5156 [DEBUG] -  - Package Exit Code / Exit On Reboot = Checked
2021-04-15 11:36:40,232 5156 [DEBUG] - System State Validation Checks:
2021-04-15 11:36:40,234 5156 [DEBUG] -  Reboot Requirement Checks:
2021-04-15 11:36:40,236 5156 [DEBUG] -  - Pending Computer Rename = Checked
2021-04-15 11:36:40,237 5156 [DEBUG] -  - Pending Component Based Servicing = Checked
2021-04-15 11:36:40,238 5156 [DEBUG] -  - Pending Windows Auto Update = Checked
2021-04-15 11:36:40,239 5156 [DEBUG] -  - Pending File Rename Operations = Ignored
2021-04-15 11:36:40,240 5156 [DEBUG] -  - Pending Windows Package Installer = Checked
2021-04-15 11:36:40,240 5156 [DEBUG] -  - Pending Windows Package Installer SysWow64 = Checked
2021-04-15 11:36:40,244 5156 [INFO ] - 2 validations performed. 2 success(es), 0 warning(s), and 0 error(s).
2021-04-15 11:36:40,246 5156 [DEBUG] - The source 'https://chocolatey.org/api/v2/' evaluated to a 'normal' source type
2021-04-15 11:36:40,247 5156 [DEBUG] - 
NOTE: Hiding sensitive configuration data! Please double and triple
 check to be sure no sensitive data is shown, especially if copying
 output to a gist for review.
2021-04-15 11:36:40,254 5156 [DEBUG] - Configuration: CommandName='version'|
CacheLocation='C:\Users\VssAdministrator\AppData\Local\Temp\chocolatey'|

ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://chocolatey.org/api/v2/'|SourceType='normal'|
Debug='False'|Verbose='False'|Trace='False'|Force='False'|Noop='True'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='False'|
AcceptLicense='False'|
AllowUnofficialBuild='False'|AllVersions='False'|
SkipPackageInstallProvider='False'|PackageNames='chocolatey'|
Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.17763.0'|
Information.PlatformName='Windows Server 2016'|
Information.ChocolateyVersion='0.10.15.0'|
Information.ChocolateyProductVersion='0.10.15'|
Information.FullName='choco, Version=0.10.15.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='VssAdministrator'|
Information.UserDomainName='WIN-4A9BUDPA9NF'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='D:\a\1\s'|
Features.AutoUninstaller='True'|
Features.ChecksumFiles='True'|Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|Proxy.BypassOnLocal='True'|
2021-04-15 11:36:40,255 5156 [INFO ] - _ Chocolatey:ChocolateyVersionCommand - Noop Mode _
2021-04-15 11:36:40,663 5156 [DEBUG] - Using 'https://chocolatey.org/api/v2/'.
2021-04-15 11:36:41,211 5156 [DEBUG] - - Supports prereleases? 'True'.
2021-04-15 11:36:41,212 5156 [DEBUG] - - Is ServiceBased? 'True'.
2021-04-15 11:36:41,420 5156 [DEBUG] - Package 'chocolatey' found on source 'https://chocolatey.org/api/v2/'
2021-04-15 11:36:41,424 5156 [INFO ] - chocolatey v0.10.15 is the latest version available based on your source(s).
2021-04-15 11:36:41,433 5156 [WARN ] - 
Chocolatey can upgrade 0/1 packages. 
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2021-04-15 11:36:41,435 5156 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2021-04-15 11:36:41,439 5156 [DEBUG] - Exiting with 0
```

@gep13 gep13 added the bug label May 5, 2021
@gep13 gep13 self-assigned this May 5, 2021
@gep13
Copy link
Member Author

gep13 commented May 5, 2021

This is associated with this issue: chocolatey/choco#2233

It was reported in the chocolatey/choco repository, but the fix will actually be addressed here. The other issue will be kept open in order to flow into the release notes that are generated for Chocolatey itself.

gep13 added a commit to gep13/nuget-chocolatey that referenced this issue May 5, 2021
As Chocolatey, we never want to create the NuGet.Config file, as this is
not used by Chocolatey at all. As such, rather than GetOrCreateDocument,
if the filepath doesn't exist, simply return the default empty
XDocument, which is exactly what would have been returned after creating
the file.

The existing coding style has been adhered to here, and as little
changes as possible have been made.
gep13 added a commit to gep13/nuget-chocolatey that referenced this issue May 6, 2021
As Chocolatey, we never want to create the NuGet.Config file, as this is
not used by Chocolatey at all. As such, rather than GetOrCreateDocument,
if the filepath doesn't exist, simply return the default empty
XDocument, which is exactly what would have been returned after creating
the file.

The existing coding style has been adhered to here, and as little
changes as possible have been made.
@gep13 gep13 closed this as completed in #24 May 6, 2021
gep13 added a commit that referenced this issue May 6, 2021
(#23) Prevent creation of empty NuGet.Config file
@gep13 gep13 added this to the 2.11.0.20210506 milestone May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant