Daniel15 / simple-nuget-server

A very simple PHP NuGet server
MIT License
116 stars 43 forks source link

Frameworks without dependencies are not saved to the database and don't appear with the NuGet client or Visual Studio #33

Closed dixong closed 5 years ago

dixong commented 6 years ago

The NuGet server expects all targetFrameworks elements in the nuspec file to have a dependency element, this is not the case for some frameworks, e.g. .NETFramework4.6.1 and .NETStandard2.0.

<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
  <metadata>
    <id>Test Package Id</id>
    <version>1.0.5</version>
    <authors>Test Author</authors>
    <owners>Test Owner</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Package Description</description>
    <copyright>Copyright</copyright>
    <dependencies>
      <group targetFramework=".NETFramework4.6.1" />
      <group targetFramework=".NETStandard1.4">
        <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
        <dependency id="System.Data.Common" version="4.3.0" exclude="Build,Analyzers" />
        <dependency id="System.Xml.XmlSerializer" version="4.3.0" exclude="Build,Analyzers" />
      </group>
      <group targetFramework=".NETStandard2.0" />
    </dependencies>
    <frameworkAssemblies>
      <frameworkAssembly assemblyName="System.Security" targetFramework=".NETFramework4.6.1" />
    </frameworkAssemblies>
  </metadata>
</package>

When viewed in Visual Studio 2017 I only see the .NETStandard1.4 framework shown in the dependencies listing, this means that when I install the package it loads as .NETStandard1.4 instead of .NETFramework4.6.1 or .NETStandard2.0.

I see that when the package is pushed to the NuGet server the framework and dependencies are extracted from the nuspec file, however, if the framework doesn't have dependencies then that framework isn't saved as a dependency to the database.

I have a fix for this and will create a PR.

Daniel15 commented 5 years ago

Fixed in #36, I think.