-
Notifications
You must be signed in to change notification settings - Fork 785
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
project with type provider builds in VS but not with "dotnet build" #10323
Comments
Similar stuff happening with FSharp.Data.SqlClient, building in VS but not from command line using dotnet sdk compiler. This boils down to full framework fsc.exe used in VS and dotnet sdk not working with type providers AFAIU:
This kind of a big deal and not sure how to work around the issue. |
As far as I can tell this type provider is still using old-style projects and targeting .NET Framework. I don't think |
@cartermp this is not the case with FSharp.Data.SqlClient which use new style SDK. Also, are you saying that dotnet SDK version of compiler cannot compile projects using type providers when the target is .NET framework? |
No, but it's complicated. Old-style projects I would not expect to be buildable by the .NET SDK. New-style is .. it depends. How much messing around with loading different toolsets is being defined in the type provider? A common problem I see is an enormously complex build for type providers that attempt to programmatically load compilers and targets based on certain conditions. That stuff just rarely ever works. |
@cartermp thanks for giving hint about the underlying issue.
In case of FSharp.Data.SqlClient, it has two "DesignTime" assemblies: the netstandard one references the types from: // Detected Target-Framework-Id: .NETStandard,Version=v2.0
// Referenced assemblies (in metadata order):
// FSharp.Core, Version=4.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Assembly reference loading information:
// There were some problems during assembly reference load, see below for more information!
// Error: Could not find reference: FSharp.Core, Version=4.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Microsoft.SqlServer.TransactSql.ScriptDom, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
// Assembly reference loading information:
// There were some problems during assembly reference load, see below for more information!
// Error: Could not find reference: Microsoft.SqlServer.TransactSql.ScriptDom, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// Assembly reference loading information:
// Info: Success - Loading from: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.4\mscorlib.dll
// netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// Assembly reference loading information:
// Info: Success - Loading from: C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.4\netstandard.dll
// System.Configuration.ConfigurationManager, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// Assembly reference loading information:
// Info: Success - Loading from: C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\3.0.0-preview6-27804-01\System.Configuration.ConfigurationManager.dll
// System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Assembly reference loading information:
// Info: Success - Loading from: C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\2.1.4\System.Data.SqlClient.dll
// System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Assembly reference loading information:
// Info: Success - Loading from: C:\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\System.Runtime.Caching\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.Caching.dll // Detected Target-Framework-Id: .NETFramework,Version=v4.6.1
// Referenced assemblies (in metadata order):
// FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (unresolved)
// Microsoft.SqlServer.TransactSql.ScriptDom, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 (unresolved)
// Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 (unresolved)
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// Assembly reference loading information:
// Info: Success - Found in Assembly List
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (unresolved)
// System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a (unresolved)
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (unresolved)
// System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (unresolved)
// System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (unresolved)
// System.Runtime.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Assembly reference loading information:
// Info: Success - Found in Assembly List Is there anything which should be done in the implementation of that particular provider which would enable support from dotnet core version of fsc to compile net framework? (In which case we'd close this issue and improve the TP / TP SDK about those problems). As a work around, is there a way to specify another fsc.exe to be used in those projects causing troubles so building from command line through edit: https://github.com/MarneeDear/FSharp.Data.SqlClient-dotnet/blob/master/fsc.props seems like a viable workaround. I'd still like to better understand the whole lifecycle that lead to the issue happening, and get some pointers to the code paths in compiler dealing with this. I assume the dotnet SDK compiler is loading the netstandard "DesignTime" assembly, but not sure what follows. |
@smoothdeveloper I think the best thing to do would be create an empty (new) TP using the latest TP template and see how that one works to diff between it and the SQLClient one. That was going to be my approach for the Azure one, although I never got around to it. |
I think your best bet is to stop trying to support net461. Just move only to .NET Standard 2.0 and simplify everything. The template here shows how to do that: https://github.com/fsprojects/FSharp.TypeProviders.SDK |
After a quick test removing .net framework target, a .net framework command line project fails to build in VS:
This is despite adding that nuget package to the project, I'm not sure what is missing (in this case, that project is compiling with net48 target despite the name). Also, the type provider targets net40 runtime, droping the .net framework binaries of the package would drop support for that target. I guess my main concern is that dotnet core compiler resolves assemblies differently than .net framework even when targetting .net framework, eventually the .net framework compiler won't be updated anymore. In this context, it may be worth the effort to make the dotnet core compiler behave the same when targetting .net framework. |
Nooooo, that will absolutely never happen. @KevinRansom might get a heart attack if that were to happen. I do not recommend supporting unsupported .NET FX runtimes like net40. It will truly be in the best long-term interest of this type provider to just target netstandard2.0 and build only with the .NET SDK compiler. Running into fundamental design issues like this are just what you're going to be signing yourself up for if you don't do that. |
@smoothdeveloper , @cartermp --- I will read this later ... the notion that I may have a heart attack is not attractive to me. Coffee and breakfast first, then i will have the fortitude to risk a medical event. |
I hope this clears things up, and at least explains some of the things you are seeing? Kevin |
Actually, not anymore, since it was so fragile/fraught with complexity. It is now entirely .NET Standard 2.0-focused. |
Thanks for the feedback and fuller overview guys, it makes it clear that it is on the TP providers (!) side to deal with this. I guess the challenge for now is to get net framework projects consume a net standard only release of the providers I'm dealing with and can be tracked in the specific projects instead. I'm closing this, maybe should be tagged by-design or such. |
@smoothdeveloper @KevinRansom I have similar problem with the Excel provider. |
@goswinr, that does not seem like the original issue. I've seen the error, albeit on .NET Core and at runtime, and solved it with |
@goswinr --- could you provide a simplified repro or point to a github repo with instructions, and we can take a look ... thanks |
thanks, @kerams |
@vzarytovskii / @KevinRansom can we remove "needs-repro", and reopen this issue? I'm attaching another sample, which involves a type provider that supports netstandard, switching the target to net6.0 in the sample doesn't change the outcome. Maybe there is a way to improve the compiler report more details about the precise issue hit during the compilation and how to adjust for it? ActualBuilds with:
Fails to build with:
ExpectedBuilds in all those scenarios. |
I have a project that targets net5.0-windows and uses SqlCommandProvider and I get this error with [Edit] I realize this is not a showstopper, |
I'm facing issue with project referencing FSharp.Management not building from
dotnet build
fsmgt.zip
When opening the same project in visual studio, it is possible to build.
Expected behavior
Able to build with
dotnet build
Actual behavior
Related information
The text was updated successfully, but these errors were encountered: