Skip to content

Feature Request: Modify nuspec file by adding empty dependency group to avoid installing many packages of netstandard15 for net46x projects #324

@moh-hassan

Description

@moh-hassan

I have faced a problem of installing many packages (of netstandard15, not needed) in a project net461.
I opened an issue in nuget

I was adviced by @PatoBeltran in nuget team:

CommandLineParser should contain a group without the netstandard dependencies that specifically targets .NETFramework to avoid unneeded dependencies.

I did POC, by adding an empty group for net45, as given below:

    <group targetFramework="net45"/>

View the details of the : solution

This line resolved the problem and installed ONE and only one package and avoided installation of the dependencies of netstandard15.

My Suggested solution:

You can modify the file CommandLine.nuspec by adding one and only one line to the dependencies section, as given below:

	<group targetFramework="net45"/>

The dependencies section will become:

<dependencies>
  <group targetFramework="net45"/>      <!-- this line added to avoid installing netstandard15 packages -->
  <group targetFramework=".NETStandard1.5">
    <dependency id="System.Collections" version="4.0.11-rc2-24027" />
    <dependency id="System.Console" version="4.0.0-rc2-24027" />
    <dependency id="System.Diagnostics.Debug" version="4.0.11-rc2-24027" />
    <dependency id="System.Globalization" version="4.0.11-rc2-24027" />
    <dependency id="System.IO" version="4.1.0-rc2-24027" />
    <dependency id="System.Linq" version="4.1.0-rc2-24027" />
    <dependency id="System.Linq.Expressions" version="4.0.11-rc2-24027" />
    <dependency id="System.Reflection" version="4.1.0-rc2-24027" />
    <dependency id="System.Reflection.Extensions" version="4.0.1-rc2-24027" />
    <dependency id="System.Reflection.TypeExtensions" version="4.1.0-rc2-24027" />
    <dependency id="System.Resources.ResourceManager" version="4.0.1-rc2-24027" />
    <dependency id="System.Runtime" version="4.1.0-rc2-24027" />
    <dependency id="System.Runtime.Extensions" version="4.1.0-rc2-24027" />
  </group>

This line solves the problem of installing many packages in the project net461 and select net45 lib as the nearest framework not selecting netstandard15.

I tested the solution as described here

and it's working fine.
Note:
It's nice to replace all pre-release packages with its RTM release for .NETStandard1.5, e.g.

"System.Collections" version="4.0.11-rc2-24027" => version=4.0.11

Let me know if any clarification is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions