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

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

Closed
moh-hassan opened this issue Sep 7, 2018 · 3 comments

Comments

@moh-hassan
Copy link
Collaborator

moh-hassan commented Sep 7, 2018

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.

@wexman
Copy link

wexman commented Oct 23, 2018

Yes, definitely needed.

@zoller27osu
Copy link

@ravenpride , @ericnewton76
#400 was not enough to fix this problem.
Adding the package via NuGet to a Net Framework 4.6.1 project in Visual Studios 2017 results in a stupid number of DLLs in your bin/[Debug/Release]/ folder.

@moh-hassan
Copy link
Collaborator Author

Fixed

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

No branches or pull requests

3 participants