-
Notifications
You must be signed in to change notification settings - Fork 71
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
Target Netstandard 2.0 #314
Conversation
I see that the DTC has a dependency on As far as I can tell, the RTC doesn't have that dependency, and so it could be compiled as a netstandard library, but I believe that would require separating the components into different binaries. @vasily-kirichenko did you have an idea about how to work around the |
It looks like the only non-netstandard dependency holdout is ScriptDom. I can't find much information about the state of that library - it's not open source and I have no idea if there is a netstandard version in the works. I'm moving forward with the assumption that we'll have to use the workaround in order to get this working with the full framework version of ScriptDom - from everything I have read, that should be doable. |
Making progress splitting into separate runtime and design time assemblies, but now I'm stuck on a compiler error:
This may be due to updating to the latest version of ProvidedTypes, but I haven't verified that one way or the other. My guess is that the temporary assembly for the generative types is available at design time but not the compiler. (?) That is, SqlEnumProvider seems to be working fine at design time (i.e., intellisense works) but failing at compile time. Not sure how to go about debugging an issue like this, anyone have any suggestions? Note that this branch is currently compiling everything on net451, so this is not a netstandard/netcore issue. |
For reference, my question on SO: https://stackoverflow.com/questions/52901474/compile-time-error-with-generative-type-provider |
f3e055d
to
7e8c1bf
Compare
So happy to see things are happening in this PR. Keep it up! 👍 🌞 |
Still moving forward, but very slowly. I've now separate runtime and design time assemblies which seem to be working as before with net40. And I've cross-targeted the runtime assembly to compile on both net40 and netstandard2.0. However, testing from a netcoreapp2.0 (I'm using Lib.fsproj to start with) referencing the netstandard version of the type provider is not going well. The setup I've got now is:
My hope is that this will work via this workaround. I'm then copying TP assemblies to the following folders (attempting to follow guidance here):
I've got an assembly reference from Lib.fsproj to the netstandard2.0/[runtime].dll. I'm getting runtime errors using any provided types:
I should point out that both the RTC and the DTC are referencing System.Data.SqlClient, and I can see the reference in the assembly manifest of the RTC, so I am not sure what to make of this error. I also get:
I'd appreciate it if someone with some expertise could a) weigh in on whether my overall approach makes sense and b) shed some light on those errors. |
So you have reached the point where I gave up fighting this monster :) Good luck. |
I was afraid of that... |
Be strong, I believe it's possible. Look at the approach used in SQLProvider. |
To confirm, a net40 project works correctly, but netcoreapp2.0 fails at runtime, correct? |
@panesofglass A net40 project works correctly referencing the net40 version of the TP, but I haven't been able to get any test project to use the netstandard2.0 version of the TP - the project fails to compile. I had been using a netcoreapp2.0 test project, but switching it to net461 also fails. I'm going to explore that case a bit more, it might help illustrate what's going on. |
Interesting: I was able to get the same test project to work (at design-time, anyway) when referencing the netstandard2.0 version of the TP by simply adding a reference to System.Data.SqlClient to the test project. So at the moment the netstandard TP seems to work for a net461 project, but not for a netcoreapp2.0 project. |
Making progress! I was just able to get netcoreapp2.0 test projects to work at compile-time and runtime just by referencing System.Data.SqlClient and System.Configuration.ConfigurationManager in the test project. I'm a bit confused as to why the latter is required (since that component is referenced in the DTC and thus shouldn't be necessary at runtime) but I don't think it should be a major issue. Still quite a bit to iron out, but this is starting to feel possible! |
I've made some progress:
Note that the RTC is entirely netstandard2.0, but the DTC has framework dependencies and thus targets net461. Can anyone shed any light as to why erased types would be working from netcore but generative types are not? |
@samhanes were I to hazard a guess, I would suggest that the erased types don't depend on any of the dependencies but the generated types do; therefore, |
@panesofglass Digging a little deeper - SqlEnumProvider works fine with a kind of
So I'm not sure what's happening. That said, it would be easy to revert to an erasing provider if that doesn't break anyone and solves the problem. |
I can only answer for myself, but I'm fine with an erasing TP. |
3c41c18
to
2d2f1fa
Compare
Progress! Both CI builds are now working, and I have changed the Travis script to compile the test projects against a hosted version of AdventureWorks. We can't run the unit tests on that build, since those require a writeable verison of the database. @vasily-kirichenko I have not looked into your issue specifically, but could you try running the build script again? I've made a bunch of changes that should fix things on linux/macos. |
Vasily, you may need to do something analogous to this: FSharp.Data.SqlClient/.travis.yml Line 15 in 0ec320d
Definitely will need to document some of these tricks :) |
I think this is ready for review and more widespread testing. There is obviously a lot happening in this PR - not sure how the maintainers want to handle this going forward? |
I' tested it at work and it's working smoothly ! |
@samhanes does appveyor not produce a nupkg? |
@samhanes thanks a lot for your contribution! I'm going to allocate some time to give it a try and will review more closely the work you have done in this PR. |
@samhanes have you tested it by creating a NuGet package and referencing it from a local folder as NuGet source? |
I still cannot build it on Mac with the same error. |
I managed to reference the nuget from a local folder, and you have to add the Import of fsc.props and netfx.props for the project to build. |
Didn't manage to use integrated security on linux, but I think it's another issue (setting kerberos etc...) |
OK,
|
@panesofglass The appveyor build does not create a nupkg, I assume publishing is a manual process. @thinkbeforecoding Good callout on the integrated security issue on linux, makes sense that it doesn't work yet. I think I'll leave that alone for now. @vasily-kirichenko I think I need to update the Fake script to use I have (now) tested against a local nupkg - appears to be working as expected. |
@samhanes thanks. Have you tested it on a .NET 4.6+ project as well? |
...and in Rider/VS/Code? |
A test for a project net45/net461/net472/netcoreapp2.1 is working fine here. |
VSCode editing is working good and fast ! |
I have tested net40/net461/net471/netcoreapp2.0 projects (net40 still using the net40 version of the TP of course) on VS and VS Code, but nothing on Rider yet. |
I did a quick review. |
@samhanes I've pulled the branch and checking it out, all the project refactoring (splits of files etc.) are good work on top of the new netstandard2.0 target. I've noticed *.dll.xml & *.dll.html files such as SqlClient.SqlServerTypes.Tests.dll.xml, could you check if we need those to be checked in? |
@smoothdeveloper I don't think we need those checked in - were they ignored before? Easy enough to fix if that's how we want it. @vasily-kirichenko Just starting to look at the building the nupkg xplat - it appears that moving from |
Thanks! |
Fantastic work, @samhanes! 🎉 👏 |
Published as version 2.0.1 |
Whew! Great news! |
No description provided.