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

DefaultPushSource in NuGetDefaults.config (ProgramData\NuGet) doesn't work #2653

Closed
fubar-coder opened this issue Apr 25, 2016 · 15 comments
Closed

Comments

@fubar-coder
Copy link

fubar-coder commented Apr 25, 2016

I always get the error message Source parameter was not specified even though my NuGetDefaults.config (stored in C:\ProgramData\NuGet) looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <config>
        <add key="DefaultPushSource" value="https://api.nuget.org/v3/index.json" />
    </config>
</configuration>

According to the documentation, this should work...

EDIT: I'm using NuGet 3.4.3.

@rrelyea rrelyea added this to the 3.4.4 milestone Apr 25, 2016
@rrelyea
Copy link
Contributor

rrelyea commented Apr 25, 2016

Putting in 3.4.4 until we know if regression or not.

@holytshirt
Copy link

This is a regression from 3.3.0

It just doesn't read the %ProgramData%\NuGet\NuGetDefaults.Config

This has just broken all our build servers as we do a update -self before restore

PS D:\TeamCityAgent\work\9ed84505b41a1255\src\.nuget> .\NuGet.exe sources
Registered Sources:

  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json
  2.  nuget.org -cached [Enabled]
      http://blah.blah.local:81/nuget/nuget.org
  3.  Blah Shared Libraries [Enabled]
      http://blah.blah.local:81/nuget/blah
  4.  Microsoft and .NET -cached [Enabled]
      http://blah.blah.local:81/nuget/nuget.org.microsoft
PS D:\TeamCityAgent\work\9ed84505b41a1255\src\.nuget> .\NuGet.exe update -self
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 3.3.0.
Updating NuGet.exe to 3.4.3.
Update successful.
PS D:\TeamCityAgent\work\9ed84505b41a1255\src\.nuget> .\NuGet.exe sources
Registered Sources:

  1.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json
PS D:\TeamCityAgent\work\9ed84505b41a1255\src\.nuget>

@rrelyea
Copy link
Contributor

rrelyea commented Apr 27, 2016

@zhili1208 can you dig into this report from @holytshirt and look at more commands ensuring that progdata is appropriately being loaded. He reports that sources doesn't load it too.
/cc @yishaigalatzer

@yishaigalatzer
Copy link

I want to understand regressions from 3.3 vs regressions from 2.x in 3.4.4 we will only fix 3.3 and on regressions

@holytshirt
Copy link

I'm good with that, this is a regression from 3.3. If you need any more information or testing from me, just let me know.

@yishaigalatzer
Copy link

@HolyShirt, are you referring to sources or defaultpushsource?

@zhili1208
Copy link
Contributor

@yishaigalatzer I think he is referring to sources, we load sources from nugetDefault.config in 3.3, but doesn't do that in 3.4. This is regression from 3.3, but 3.3 has another issue: writing sources from nugetDefault.Config to local nuget.config during saving package sources.

@holytshirt
Copy link

holytshirt commented Apr 28, 2016

@yishaigalatzer as @zhili1208 said 3.3 does not load %ProgramData%\NuGet\NuGetDefaults.config due to a path issue.
This is suggest location for machine wide settings for nuget configuration https://docs.nuget.org/consume/nuget-config-defaults.

Not loading this file causes all default settings to be not load for :

  • Enabled package sources
  • Registered, but disabled-by-default package sources
  • The default nuget.exe push source

@fubar-coder
Copy link
Author

fubar-coder commented Apr 28, 2016

I suggest fixing this for 3.4.4 anyway, because the removal of the default push source being nuget.org is a breaking change without a solution (yet).

@yishaigalatzer
Copy link

We will have a 3.4.4 build out today for verification

@rrelyea
Copy link
Contributor

rrelyea commented Apr 28, 2016

@holytshirt I'm seeing slightly different behavior with my testing. can you tell us the paths of the different config files under %progdata%, along with their contents?

@holytshirt
Copy link

@rrelyea
This is from a clean rebuilt build agent so %ProgramData%\NuGet\NuGetDefaults.config is the only nuget configuration on the machine, which gets pushed out via global policy.
%ProgramData%\NuGet\NuGetDefaults.config maps to C:\ProgramData\NuGet\NuGetDefaults.config and that files contains

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- DefaultPushSource key is similar to the 'DefaultPushSource' key of NuGet.config schema-->
    <!-- This can be used by administrators to prevent accidental publishing of packages to nuget.org -->
    <config>
        <add key="DefaultPushSource" value="http://localnuget.company.local:81/nuget/company/" />
    </config>

    <!-- Default Package Sources -->
    <!-- They cannot be deleted or modified but can be disabled/enabled by user -->
    <!-- The following section is similar to 'packageSources' section of NuGet.config schema -->
    <packageSources>
        <add key="nuget.org -cached (localnuget)" value="http://localnuget.company.local:81/nuget/nuget.org" />
        <add key="companyShared Libraries (localnuget)" value="http://localnuget.company.local:81/nuget/company" />
        <add key="Microsoft and .NET -cached (localnuget)" value="http://localnuget.company.local:81/nuget/nuget.org.microsoft" />
    </packageSources>

    <!-- Default Package Sources that are Disabled by Default -->
    <!-- They cannot be modified or deleted either but can be enabled/disabled by user -->
    <!-- The following section is similar to 'disabledPackageSources' section of NuGet.config schema -->
    <!-- The value part of the entry in 'disabledPackageSources' section has no effect -->
    <disabledPackageSources>
    </disabledPackageSources>
</configuration>

Anything else you need?

@rrelyea
Copy link
Contributor

rrelyea commented Apr 28, 2016

That helps. Thx. We are considering options.
I was using %ProgramData%\nuget\config\foo.config, instead of %programdata%\nuget\NugetDefaults.config -- so my sources didn't disappear.
DefaultPushSource was broken in both ways.

zhili1208 added a commit to NuGet/NuGet.Client that referenced this issue Apr 28, 2016
zhili1208 added a commit to NuGet/NuGet.Client that referenced this issue Apr 29, 2016
@zhili1208
Copy link
Contributor

@zhili1208 zhili1208 assigned spadapet and unassigned zhili1208 Apr 29, 2016
@spadapet
Copy link

I tested DefaultPushSource in local nuget.config, user nuget.config, and machine nugetdefaults.config. Works fine.

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

No branches or pull requests

8 participants