Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Why is the content from my .nupkg files getting lost when I publish symbols?



  • I have a NuGet package I'm trying to publish that contains both assemblies and content files. After publishing the standard and symbols packages, the content files from the standard package are gone.

    When I run NuGet packaging the filesystem looks like this:

    MyProduct.nuspec
    content/
      Web.config.install.xdt
    lib/
      net45/
        MyProduct.dll
        MyProduct.pdb
        MyProduct.xml
    src/
      Class1.cs
      Class2.cs
    

    As you can see, I have it all set up and ready to go.

    I then run the commands to pack the NuGet packages using nuget.exe version 2.8.5:

    nuget.exe pack MyProduct.nuspec
    nuget.exe pack MyProduct.nuspec -Symbols
    

    What I get out of that is two package files:

    MyProduct.1.0.0.nupkg
    MyProduct.1.0.0.symbols.nupkg
    

    If I look inside the MyProduct.1.0.0.nupkg file, I see:

    content/
      Web.config.install.xdt
    lib/
      net45/
        MyProduct.dll
    

    If I look inside MyProduct.1.0.0.symbols.nupkg I see:

    lib/
      net45/
        MyProduct.dll
        MyProduct.pdb
        MyProduct.xml
    src/
      Class1.cs
      Class2.cs
    

    Note the important difference there: the symbols package doesn't contain the content files. That's not something I have control over - it's the way nuget.exe packages things and is the standard per the NuGet documentation.

    I then push the first package to my ProGet server:

    nuget.exe push MyProduct.1.0.0.nupkg myapikey -s http://proget/feeds/Default
    

    If I download that package immediately after pushing, I can open it up and see the content files are still there. It's exactly like the MyProduct.1.0.0.nupkg file that I pushed. ProGet doesn't show symbols as being available yet because, obviously, they're not.

    I then push the symbols package:

    nuget.exe push MyProduct.1.0.0.symbols.nupkg myapikey -s http://proget/feeds/Default
    

    ProGet now shows symbols as being available and I can download a symbol package that includes PDB and source files. If I download the symbols package MyProduct.1.0.0.symbols.nupkg from ProGet, it's exactly like the one I pushed.

    If I download the MyProduct.1.0.0.nupkg package now, after pushing symbols, the content files are gone. The MyProduct.1.0.0.nupkg on ProGet now looks like this inside:

    lib/
      net45/
        MyProduct.dll
    

    The content is gone.

    I did find this question where it sounded like folks assumed a symbol package only differs from a regular package by the fact that the symbol package has everything the regular package has with the addition of PDB and source files.

    This is not the case. Symbol packages strip out content, build, tools, and other stuff that isn't symbols.

    I am guessing that by uploading the symbols package, ProGet is dynamically re-creating the non-symbol package internally based on what's in the symbols package. I can't say for sure, but that's certainly how it appears.

    As a temporary workaround, I'm going to have to stop publishing symbols for this package until I have a resolution.

    Where did my content go and how can I get it back?

    Product: ProGet
    Version: 3.7.3



  • Interesting discovery:

    If I only do...

    nuget.exe pack MyProduct.nuspec
    

    ...then the package I get is the giant package with everything in it. It's the second command with the -Symbols flag which creates two separate packages where one has only content/libraries and the other has only symbols/source.

    In fact, it appears the two commands are somewhat redundant in NuGet 2.8.5 - you can create both packages all at once using the -Symbols flag; or you can create One Big Package With Everything if you omit the -Symbols flag.

    If I publish the One Big Package With Everything then things work.

    That is, if I was going to publish to standard NuGet, I'd do the pack with -Symbols, publish the standard package to NuGet, and publish the symbol package to SymbolSource.

    But if I'm publishing to ProGet, I don't pack with -Symbols, then I publish the package that has everything in it all at once to ProGet. ProGet will then do the separation of symbols and standard package contents for me... and the content files will be present.

    Somewhat non-standard and totally not clear, but at least I figured it out.



  • The reason it disappears is documented here: Symbol and Source Server

    We had considered the case where users would upload both packages and attempt to automatically merge them into a single one, but we have found that it would be extremely difficult if not impossible to do this automatically considering you can put anything into a nuget package.

    If you want the exact same behavior as the nuget.org/symbolsource.org combination, either:

    • simply add another ProGet feed (i.e. Default-Symbols) and push the symbols package to that one, then use that in the Visual Studio configuration.
    • -or- pack one big package with all the files in it and only upload that one


  • It would be good to clarify the "Symbol and Source Server" document you linked to explain that you don't actually just want to push the symbols package; you want to push a package that contains everything.

    The way the document currently reads, which is why I got hung up, is that it talks about the two different packages - non-symbols vs. symbols - and then later says to only push the symbol package which is wrong. Symbol packages built with -Symbols don't include content files. I recognize the race condition issue, but the description that symbols packages only differ by adding symbols and source is incorrect. The typical symbol package only has symbols and source.



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation