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

Support .NET Core #126

Closed

Conversation

enricosada
Copy link

@enricosada enricosada commented Jul 26, 2016

Add .NET Core 1.0 RTM support (netstandard1.6) using .NET Core SDK preview2

The build.bat now add netstandard to package, if env var UNQUOTE_NETCORE is 1 if .net core sdk is installed ( the dotnet --info return exit code 0)
IMPORTANT change version inside Unquote/project.json before of the build, so is the same number as built process

How to try it:

First restore

dotnet restore

After that

dotnet test UnquoteTests

this will build Unquote, and run UnquoteTests tests
Same for VerifyNunit3Support, VerifyXunit2Support

The VerifyNonFrameworkSupport is a console app, so instead

cd VerifyNonFrameworkSupport
dotnet run

@stephen-swensen
Copy link
Contributor

@enricosada this is great, thank you! Looking forward to digging in.

@enricosada
Copy link
Author

I'll check appveyor failure.

Btw @stephen-swensen any issue, feel free to ping me or #dotnetcore fsharp.org slack channel

@enricosada
Copy link
Author

sry, locally i have an error with portable profile with msbuild (maybe i need something installed, dunno)

e:\github\unquote\Unquote.Profile259\unknown(1,1): error FS0078: Unable to find the file 'System.Runtime.InteropService
s.dll' in any of� C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile\Profile259�
 e:\github\unquote\Unquote.Profile259� C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETCore\3.259.3.1
[e:\github\unquote\Unquote.Profile259\Unquote.Profile259.fsproj]

so when fixing f# 3 conditionals (instead of f# 4), i didnt see the error.

i always tried locally with build.bat (works for me, create the package).

@stephen-swensen
Copy link
Contributor

@enricosada I'm not all up-to-date on .NET Core / Standard so excuse my ignorance, but according to Don's comment at fsprojects/.github#10 (comment) , PCL 259 can be referenced from a .NET Core / Standard project... Unquote supports PCL 259 so I am wondering what the point of additionally supporting .NET Core / Standard is (may be totally misunderstanding everything)?

@enricosada
Copy link
Author

@stephen-swensen sry for late reply, i was in vacation :P

you can import the pcl, but there are some issue currently.
I got these errors trying to use imported unquote pcl from others dotnetcore project (Argu for example).

I think there is an issue because unquote is referencing FSharp.Core from gac (net40), not only pcl assemblies.

If create a console app, add the import of pcl, the app restore and build correctly, but at runtime:

Unhandled Exception: Swensen.Unquote.AssertionFailedException: Test failed:

([3; 2; 1; 0] |> List.map ((+) 1)) = [1 + 3..1 + 0]
System.TypeInitializationException: The type initializer for '<StartupCode$Unquote>.$Swensen.Unquote.DynamicOperators' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Numerics.BigInteger' from assembly 'FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
   at <StartupCode$Unquote>.$Swensen.Unquote.DynamicOperators..cctor()
   --- End of inner exception stack trace ---
   at Swensen.Unquote.Evaluation.eval(FSharpList`1 env, FSharpExpr expr)
   at Swensen.Unquote.Reduction.reduce(FSharpList`1 env, FSharpExpr expr)
   at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc`2 mapping, FSharpList`1 x)
   at Swensen.Unquote.Reduction.reduce(FSharpList`1 env, FSharpExpr expr)
   at Swensen.Unquote.Reduction.loop@126(FSharpList`1 env, FSharpExpr expr, FSharpList`1 acc)

Also imports doesnt work using dotnet sdk tools (the tools section) but i dont think that an issue for unquote, because is used in tests.

Last, netstandard1.6 it's another target profile, so additional assemblies who doesnt mess with other users of your library, but unlock the projects who are trying to convert the test suite to dotnetcore.

More info about pcl and netstandard from docs and for libs

@enricosada
Copy link
Author

if you need i can gist you the code with imported pcl of unquote 3.1.2, if you think can be useful to fix that error

@stephen-swensen
Copy link
Contributor

@enricosada yes that would be helpful. Wondering if we can just massage Unquote's PCL build so that it is sufficient for use by other projects without creating another profile.

@enricosada
Copy link
Author

enricosada commented Sep 2, 2016

in theory, pcl 259 is netstandard1.0 so should work, but..

anyway the example https://gist.github.com/enricosada/a639815605b32840fa3423235c9dfbe9

dotnet restore
dotnet run

i know is another profile, but the netstandard is the way forward for multitargeting, and improve the pcl (for example library author can choose the minimal api surface, fsharp.core should lower netstandard1.6 to 1.3 i think) so newer or different platform can be supported (pcl restrict the platform to a subset)

if you want to try a new pcl nuget package:

  • increment the version inside project.json

and

dotnet restore -f dir/to/new/pkg
dotnet run

neoeinstein added a commit to neoeinstein/anat that referenced this pull request Oct 21, 2016
This also adds conditional includes to workaround issues with Unquote on .NET Core. (See SwensenSoftware/unquote#126)
@neoeinstein
Copy link

neoeinstein commented Feb 23, 2017

Note that I have posted up another conversion to .NET Core at https://github.com/neoeinstein/unquote/tree/netcore. I also have published it as a package on my personal MyGet feed here: https://www.myget.org/F/neoeinstein/api/v3/index.json

@tomasaschan
Copy link

Is there any update on this, now that .NET Core tooling is 1.0? Is there anything I could do to help and/or test?

@neoeinstein I tried to install Unquote from your personal feed, but the package isn't listed there... :(

@stephen-swensen
Copy link
Contributor

stephen-swensen commented Apr 6, 2017

@tlycken Hi - my update is this: i have been hesitant to consider .NET Core up until now because of the instability (e.g. JSON vs. MSBUILD project formats)... it looks like that is settling down and it is now on my radar for real. Not sure yet about time line, but I am thinking there will be a Unquote 4.0 release that targets .NET 45 and .NET Core (whatever) while deprecating PCL and .NET 40 builds...

Any thoughts welcome, it's difficult to keep a solid grasp of the prominent .NET build profiles from year-to-year...

(thanks, any nudge helps me, and I appreciate the offer for help!)

@tomasaschan
Copy link

@stephen-swensen I feel you - I sort-of gave up on keeping track of the tooling when they announced they were ditching project.json, and decided to wait for RTM. But that was released last week, so we can probably expect it to have stabilized now :)

There's a decent tutorial on microsoft.com that I found worked very well when following it exactly, but stumbled onto some subtleties when I tried to apply it to port a project of mine. I guess with some effort it shouldn't be a problem. Either way, I think that - and similar resources - is a good start for porting this library too.

Since this PR uses the preview2 version of the tooling, we'd probably have to re-do some of the work here. Perhaps @enricosada is better posed to know which changes here can be re-used?

@neoeinstein
Copy link

@tlycken The version of unquote that you need to use for my feed is 3.1.3-alpha-170218.

@enricosada
Copy link
Author

@stephen-swensen @tlycken @neoeinstein i'll finish this, converting to fsproj.

@stephen-swensen now tooling is stable and rtm. Tooling was ok in preview2 too, source code changes will be the same, but now is expected to stay stable for quite a bit.

as a note, project.json (preview2) -> fsproj (1.0 rtm) tutorial is in the wiki https://github.com/dotnet/netcorecli-fsc/wiki/How-to-migrate-preview2-projects-to-1.0

@enricosada
Copy link
Author

Sry @neoeinstein didnt see your branch.
I'll integrate your changes in my PR, i think here there is also tests and build script done.

@enricosada
Copy link
Author

Sorry another time @neoeinstein , seems i was a bit too optimistic about my free time for do this.
I'll close, if someone want to continue branch continue to exists

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

Successfully merging this pull request may close these issues.

4 participants