DavidArno / SuccincT

Discriminated unions, pattern matching and partial applications for C#
MIT License
267 stars 15 forks source link

NetStandard Dependencies #39

Closed megafinz closed 7 years ago

megafinz commented 7 years ago

When I try to update SuccincT from 2.3.0 to 3.0.0, I get like 15 new packages as dependencies. Is there a way to avoid that (apart from waiting for NetStandard 2.0 which, I assume, should bring a single package as dependency)?

My app is WPF desktop application that targets .Net Framework.

Maybe this is relevant: https://stackoverflow.com/questions/42855180/how-to-create-net-standard-nuget-package-with-minimal-dependencies-in-vs-2017

DavidArno commented 7 years ago

Oh, that's disappointing and surprising as one of the reasons I went down the dotnet standard route was to simplify dependencies. Doesn't sound like it worked though.

Thanks for the link, I'll take a look.

DavidArno commented 7 years ago

So according to that link, I need to target both netstandard1.0 and .NET 4.5, and thus create a nuget package with dll's targeting those two. Then .net framework projects use the latter and so do not pull in all the netstandard dependencies!??!? That seems completely broken to me. This only appears to happen if you are using the old-style csproj files s I'm not seeing this in my test-harness.

I can push a v3.0.1 version that does this, but it seems to defeat the purpose of netstandard. So I'll ask around to see if there's a better solution, but will create that new release to tidy things up for you if this really is the only solution.

megafinz commented 7 years ago

This only appears to happen if you are using the old-style csproj files

Hm, I'll investigate how to upgrade to the new project file format to see if this helps. Things change quite often now, project.json died even before I had a chance to try it.

megafinz commented 7 years ago

Seems that new csproj format doesn't work for WPF projects at this moment. http://www.natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/ https://github.com/dotnet/project-system/issues/1467

I'll try Paket to see if that helps to keep reference list sane.

DavidArno commented 7 years ago

@megafinz,

Microsoft's @terrajobst has kindly provided more details of what's going on with netstandard at the moment, in this answer to that Stack Overflow question you linked to.

Assuming I'm reading that answer correctly, the current choices are:

  1. Accept the extra dependencies that a dotnetstandard library pulls into a framework project,
  2. Target net45 too in the nuget package to prevent those dependencies,
  3. Handcraft the nuspec file to only pull in the dependencies really required,
  4. Wait for netstandard 2.0, which will fix many of these issues.

Option 1 isn't good for you. Option 3 sounds hard and as Immo says, it risks being fragile. So option 2, followed by a new release using option 4 when netstandard 2.0 is released seems the best route. So I'll push out a v3.0.1 version that includes net45 shortly.

DavidArno commented 7 years ago

@megafinz,

I've pushed a v3.0.1 version to nuget. Would you mind testing it to see if it solves this issue for you, please? If it's OK, I'll then update the docs to make it "public".

megafinz commented 7 years ago

@DavidArno yep, everything is nice. I created a demo project that targets .Net 4.6.1. SuccincT 3.0.1 brings only one package, SuccincT 3.0.0 adds 46 more packages as dependencies into packages.config.

DavidArno commented 7 years ago

Excellent. Docs updated to make v3.0.1 "official".