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

Add support for .NET Core #23

Closed
rianjs opened this issue Jul 3, 2016 · 34 comments
Closed

Add support for .NET Core #23

rianjs opened this issue Jul 3, 2016 · 34 comments
Labels

Comments

@rianjs
Copy link
Owner

rianjs commented Jul 3, 2016

  • Get rid of Hashtable usage in ANTLR parser
  • Get rid of ArrayList usage in ANTLR parser
rianjs added a commit that referenced this issue Jul 9, 2016
rianjs added a commit that referenced this issue Jul 9, 2016
…ted all Hashtables to Dictionaries, and all ArrayList to List #23
rianjs added a commit that referenced this issue Jul 9, 2016
rianjs added a commit that referenced this issue Jul 9, 2016
rianjs added a commit that referenced this issue Jul 9, 2016
idiomatic xproj usage until the tooling (ReSharper, Visual Studio)
improves. All .Net Core changes were back-ported to the non-Core library,
so this should be easy-ish in the future. Right now, though, we have two
side-by-side versions of ical.net in the repo. The .Net Core version is in
the `ical-core` directory. #23
@rianjs rianjs mentioned this issue Jul 9, 2016
@rianjs
Copy link
Owner Author

rianjs commented Jul 9, 2016

Normally I wouldn't merge half-completed work back into master, but there was too much value unrealized due to back-porting changes as I prepped the library for .NET Core. It looks like unit test runtimes will be down below 2 seconds after this work.

@khalidabuhakmeh
Copy link
Collaborator

Any thoughts to migrating to xunit?

@rianjs
Copy link
Owner Author

rianjs commented Jul 10, 2016

To xUnit from nUnit? I haven't thought about it.

@kdaveid
Copy link
Collaborator

kdaveid commented Jul 13, 2016

Hi Rian
Great work and thanks for taking over the project. I have the source running for a while.

I'd like to contribute on ASP.NET Core branch. Is there one? How far are you in porting it?

Thanks and have a great day,
David

@rianjs
Copy link
Owner Author

rianjs commented Jul 13, 2016

@kdaveid - I'd be thrilled for someone else to also work on this. I don't love managing build configurations and pipelines. This PR has some information on where the .NET Core port stands now: #28

The non-Core code has diverged a little bit, as I've been on a deleting/simplification spree, but I haven't written any new code that will be incompatible with .NET Core, AFAIK. I see several possibilities:

Option 1: delete all the directories underneath net-core/..whatever../src except for the xproj files. Copy and paste the directories containing the unit tests, ical, and ical collections .cs files. That'd get you most of the way there. After restoring the required nuget packages, it should build. I'm not wild about this possibility because Microsoft is going to back to XML-based project files rather than project.json and (presumably) global.json, so I don't have much interest in learning that way of building .NET code.

Option 2: Add another build configuration to the csproj files that already exist. According to the blog post linked, targeting PCL profile 259 will create a binary that runs on CoreCLR, which is effectively a port, skipping the bad tooling support and build/configuration management flux that's happening now. I'm assuming ReSharper's test runner and nunit will play nicely, because I assume that it's just a "normal" csproj-based solution. https://oren.codes/2015/07/29/targeting-net-core/

When I got up the energy, I was going to give option 2 a go. My guiding thoughts are these:

  • No duplicate code bases. (What's underneath the net-core is (and always was) meant to be temporary. Whether it gets hoisted up, and overwrites the non-Core source, or something else... it was always temporary, meant as a "what will this take" experiment.
  • Emitting binaries should be a single "command". Right now, that's the Batch Build option in Visual Studio. I'm also happy with a CLI process. Either way, I don't want to have to move the .NET Core binary output to directory A, the non-Core output to directories B..D. I.e. no hand-manicuring of binary output. It's too error-prone.
  • Nuget should just work. Today that's a 1) Increment the version number in the nuspec file and run nuget pack and we're ready to upload a new version. I don't really want to deviate too far from that relatively straightforward process.

@khalidabuhakmeh
Copy link
Collaborator

Option #1 is the one me and my team have been doing. It is better to bite the bullet on migrating to the new project structure, rather than trying to shoehorn stuff into csproj. I believe the .NET team is working on tooling to make this migration automatic.

@rianjs
Copy link
Owner Author

rianjs commented Jul 13, 2016

I don't think so, @khalidabuhakmeh. project.json and global.json are going away in favor of csprojs:

We had two choices. One was to move all .NET projects to use project.json. This would require us doing tooling work that touches all of the project types in Visual Studio, Xamarin and our partners like Unity. We would have to expand project.json to support all the build scenarios required by each of these project types and provide a migration story. Another choice was to build bridges so an .xproj project can reference a .csproj project and a .csproj project can reference an .xproj project in Visual Studio and Xamarin Studio. The bridge has challenges as well, for example when a customer creates a project they would now have to choose an .xproj or a .csproj, which just adds more choices and complexity.

After looking at our choices, it was apparent that it would be easier to move .NET Core projects to .csproj/MSBuild so all .NET projects use the same tooling and build system.

https://blogs.msdn.microsoft.com/dotnet/2016/05/23/changes-to-project-json/

@rianjs
Copy link
Owner Author

rianjs commented Jul 13, 2016

objectType.GetTypeInfo().IsEnum in SerializerFactory works in .NET 4.5+, but not in .NET 4.0. Maybe we need an ifdef. Ugh.

Maybe:
http://stackoverflow.com/questions/3436526/detect-target-framework-version-at-compile-time

rianjs added a commit that referenced this issue Sep 19, 2016
rianjs added a commit that referenced this issue Sep 19, 2016
rianjs added a commit that referenced this issue Sep 19, 2016
rianjs added a commit that referenced this issue Sep 25, 2016
rianjs added a commit that referenced this issue Sep 25, 2016
rianjs added a commit that referenced this issue Sep 25, 2016
rianjs added a commit that referenced this issue Sep 25, 2016
rianjs added a commit that referenced this issue Oct 18, 2016
@maitredede
Copy link

Hi,

Beside the fact that NUnit does not work (yet) is your code ready for dotnet core ?

@rianjs
Copy link
Owner Author

rianjs commented Feb 9, 2017

Yup. I'm about to push up a branch, or replace the v3 project, I haven't decided which.

I wish nunit would hurry up and get their act together.

@rianjs
Copy link
Owner Author

rianjs commented Feb 9, 2017

I swapped the .NET Core version for the v3 version. .NET Core was based on v3 (line for line). I view .NET Core as the next major revision of ical.net. When VS2017 drops for real, and nunit is working, I'll publish a real v3 on nuget.

In the meantime, you can clone the repo, and compile the binaries yourself if you need a .NET Core version.

@rianjs
Copy link
Owner Author

rianjs commented Feb 11, 2017

Hmm, weird. I created the stuff under the net-core directory using VS2017RC from scratch, and it worked for me without needing to fiddle with anything. Be aware that that's the v3 API, so Event is now CalendarEvent, for example. And a bunch of IValueObject-y interfaces are gone, so you'll get real objects back in many cases without needing to cast.

That directive basically says "find and compile all .cs files under the directory trees". I wonder if there were duplicates or something? If you have your Output log still (or can re-create the error), I'd love to see it.

--

Anyway, there are two steps left to incoporating it into the nuget package:

  • Figuring out how to package TFM and Core assemblies together, and
  • nunit tests working

I could get away with nunit not working so long as all fixes are back-ported to v2 where I can still run the test suite.

@rianjs
Copy link
Owner Author

rianjs commented Feb 11, 2017

No, my VS2017 is from 3-4 weeks ago. This is why I don't usually mess with pre-release stuff: it's a moving target and a complete time-waster.

@jtillman
Copy link

Bumping now that VS17 Finally was released

@mixerp
Copy link

mixerp commented Mar 21, 2017

What is the current status?

@rianjs
Copy link
Owner Author

rianjs commented Mar 21, 2017

Waiting for nunit + ReSharper support.

@felschr
Copy link

felschr commented Mar 22, 2017

@rianjs Would you be ok with migrating to xunit? I could probably spare some time to help you with it.
I recently migrated a project of mine from nunit to xunit, it shouldn't be too hard.

Also could you publish a prerelease on NuGet of the current version?

@rianjs
Copy link
Owner Author

rianjs commented Mar 22, 2017

Would you be ok with migrating to xunit? I could probably spare some time to help you with it.
I recently migrated a project of mine from nunit to xunit, it shouldn't be too hard.

I'm not convinced it's worth the time. The nunit people are working on real .NET Core support, and R# is (apparently) right around the corner.

If we get to June-July and there's still no real .Net core nunit, I'll be more interested switching to xUnit. In the meantime, doing the work (there's about 350 unit tests) just to move a shipping date closer doesn't seem worth it.

Also could you publish a prerelease on NuGet of the current version?

Sure, I'll see if I can do that.

@rianjs rianjs added the v3 label Mar 22, 2017
@rianjs
Copy link
Owner Author

rianjs commented Mar 22, 2017

netstandard1.6 nuget package:
https://www.nuget.org/packages/Ical.Net/3.0.1-alpha

The API is slightly different. Off the top of my head, all the interface version of calendar components are gone:

  • IEvent -> CalendarEvent
  • IAlarm -> Alarm

That sort of thing. It should be fairly intuitive.

@rianjs
Copy link
Owner Author

rianjs commented Mar 22, 2017

I probably should have named it 3.0.1-net-core-alpha instead. Oh well.

rianjs added a commit that referenced this issue Mar 22, 2017
rianjs added a commit that referenced this issue Mar 22, 2017
.NET Core nuget prerelease package #23
@felschr
Copy link

felschr commented Mar 22, 2017

@rianjs I'm fine with that. Let me know if/once you would like my help.
Thank's for putting up the alpha!

@rianjs
Copy link
Owner Author

rianjs commented Mar 22, 2017

If you try it out, let me know if it doesn't behave as expected.

Ideally I'd like to retire the Framework versions, and just have .NET Core versions, as I believe Framework versions will use .NET Core libraries, assuming the API surface area (netstandard version) overlaps.

@felschr
Copy link

felschr commented Mar 22, 2017 via email

@remyjette
Copy link
Collaborator

remyjette commented Mar 23, 2017

Hey, thanks for pushing the net-core version to NuGet!

I'm giving it a try in a sample .NET Core console app. I made a quick pull request to the .nuspec to add the NodaTime dependency, but I have one other issue. EDIT: See #253

rianjs pushed a commit that referenced this issue Mar 23, 2017
rianjs added a commit that referenced this issue Mar 23, 2017
@rianjs
Copy link
Owner Author

rianjs commented Mar 23, 2017

Let's fork off separate issues, using this as a master ticket:

  • Stick a reference to Add support for .NET Core #23 somewhere in the text of the new ticket
  • Prefix the issue title with [.NET Core], and label it v3 and whatever other labels apply.

@rianjs
Copy link
Owner Author

rianjs commented Nov 13, 2017

This has been done for a while now.

@rianjs rianjs closed this as completed Nov 13, 2017
@jasoncoding
Copy link

Could you update where things are with respect to .net core support? Does version 4.x have core support or is it still back in the 3.x.beta releases?

@remyjette
Copy link
Collaborator

I'm using 4.x in a .NET Core project right now.

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

No branches or pull requests

10 participants