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

Migrate to .NET Core #7

Closed
3 tasks done
Pathoschild opened this issue Jun 30, 2016 · 15 comments
Closed
3 tasks done

Migrate to .NET Core #7

Pathoschild opened this issue Jun 30, 2016 · 15 comments
Assignees
Milestone

Comments

@Pathoschild
Copy link
Owner

Pathoschild commented Jun 30, 2016

Migrate the fluent client to .NET Core 1.0 and .NET Standard.

To do

  • update NuGet packages.
  • migrate to project.json.
  • migrate to .NET Standard 1.1 1.3.
@Pathoschild Pathoschild self-assigned this Jun 30, 2016
Pathoschild added a commit that referenced this issue Jun 30, 2016
Pathoschild added a commit that referenced this issue Jun 30, 2016
@Pathoschild
Copy link
Owner Author

Pathoschild commented Jul 4, 2016

Switched to project.json in 2.2, but waiting on dotnet/aspnetcore#1558 for the migration to .NET Standard. The pending migration is in the mod/net-standard branch.

@Jericho
Copy link
Contributor

Jericho commented Dec 8, 2016

I was wondering if there was any progress regarding migration to netstandard?

@Pathoschild
Copy link
Owner Author

At the time I was waiting on dotnet/aspnetcore#1558, which is still open. I'm looking forward to .NET Core 1.2, which looks much more polished; once that's released, I'll see about migrating even if I have to hack around that issue.

Though pull requests are welcome if you'd like to try your hand at it before then. :)

@Jericho
Copy link
Contributor

Jericho commented Dec 8, 2016

I just forked, looking into it. First struggle: I can't get nunit to work. I personally use xunit so I'll see if I can easily switch just so I can get past this issue.

@Jericho
Copy link
Contributor

Jericho commented Dec 8, 2016

I give up: I am unable to resolve the problem that prevents using the Microsoft.AspNet.WebApi.Client package in a netstandard library. However, I came up with a workaround. Here's what I propose:

  1. Configure the project.json to produce two versions of the Client: one for net452 and one for netstandard1.3
  2. Configure the nuspec to bundle both versions in the nuget package. This ensures that your nuget package can be used in projects targeting .Net 4.5.2 (or more recent), also it can be used by libraries targeting netstandard1.3 (or more recent) and finally, it can also be used by apps targeting .Net Core 1.0 (or more recent).
  3. Configure the Microsoft.AspNet.WebApi.Client package to be referenced by the net452 version of your library ONLY (this is important since we know it doesn't work in netstandard)
  4. Use an alternative package in the netstandard1.3 version of your library. This is a temporary solution until Microsoft releases a version of their package which is compatible with netstandard1.3.

It so happens that there is an alternative package which was created by people who were experiencing this same problem. They describe their package as:

System.Net.Http.Formatting project compiled for .NET Standard

The nice thing about this package it that they used the same namespace and class names as the Microsoft.AspNet.WebApi.Client which means that we can use it without changing our code. Brilliant!

If you agree with my suggestions, I can submit a PR. One detail though: I have no experience with NUnit so I don't know if it supports "multi-targeting" projects. I use xUnit in my libraries that target multiple platforms and it works great: I write my tests only once and they are automatically run for each platform. I can certainly help if you are interested in switching to xUnit, but I will leave it to you to figure out if you decide to stick with NUnit.

@Pathoschild
Copy link
Owner Author

Sure, that sounds good in theory. I'm not opposed to switching to xUnit, but ideally that should be a separate PR (either before or after).

@Jericho
Copy link
Contributor

Jericho commented Dec 8, 2016

Have you been able to run the NUnit tests on the mod\net-standard branch? I can't get it to work.

@Jericho
Copy link
Contributor

Jericho commented Dec 8, 2016

ok I figured out what was wrong: your unit test project is not configured to use the nunit test runner. No need to switch to xUnit after all.

Committing a fix.

@Jericho
Copy link
Contributor

Jericho commented Dec 8, 2016

Please note: the Serialize_IFormattable_WithoutIrreversibleSerialization unit test is failing. This is due to the fact a 'manifest resource' is missing from the alternative nuget package we are using. I think it's safe to ignore this failure until Microsoft releases a netstandard1.3 version of their package.

@Pathoschild
Copy link
Owner Author

Thanks! I merged in the PR. The changes look fine overall, unit tests pass, and I didn't find anything of concern when I decompiled the WinInsider package. Everything seems to be working fine in one of my .NET Framework projects. Could you confirm the attached NuGet package works fine in your .NET Core projects before I release it?

@Jericho
Copy link
Contributor

Jericho commented Dec 9, 2016

Submitted PR #9 for a correction in nuspec

@Pathoschild
Copy link
Owner Author

Merged! Here's the new package to test, though I'll wait for your other proposed changes to release them all together.

Pathoschild.Http.FluentClient.2.3.0.zip

@Pathoschild
Copy link
Owner Author

If you can confirm this works fine with your .NET Core projects, I'll release 2.3 with it now. The other changes we're discussion can be rolled into 2.4 when they're ready.

@Jericho
Copy link
Contributor

Jericho commented Dec 10, 2016

I confirm all my unit tests and integration tests are successful with 2.3.0

@Pathoschild Pathoschild added this to the 2.3 milestone Dec 12, 2016
@Pathoschild
Copy link
Owner Author

Published on NuGet. Thanks!

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

No branches or pull requests

2 participants