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

Reference Type Provider Design-Time Reference Assemblies #2272

Closed
isaacabraham opened this issue Mar 8, 2019 · 13 comments
Closed

Reference Type Provider Design-Time Reference Assemblies #2272

isaacabraham opened this issue Mar 8, 2019 · 13 comments

Comments

@isaacabraham
Copy link
Contributor

The following FAKE script does not build.

#r "paket:
nuget Fake.Core.Target
nuget FSharp.Data.SqlClient //"
#load "./.fake/build.fsx/intellisense.fsx"
open Fake.Core
open Fake.Core.TargetOperators
open FSharp.Data

// Default target
Target.create "Default" (fun _ ->
    Trace.trace "Hello World from FAKE"
)

// start build
Target.runOrDefault "Default"

with the following error:

Script is not valid:
        startup (1,0)-(1,0): Error FS3031: The type provider 'xxxxx\.nuget\packages\fsharp.data.sqlclient\2.0.2\lib\netstandard2.0\FSharp.Data.SqlClient.dll' reported an error: Assembly attribute 'TypeProviderAssemblyAttribute' refers to a designer assembly 'FSharp.Data.SqlClient.DesignTime.dll' which cannot be loaded or doesn't exist. Could not load file or assembly 'xxxxx\.nuget\packages\fsharp.data.sqlclient\2.0.2\lib\netstandard2.0\FSharp.Data.SqlClient.DesignTime.dll'. Das System kann die angegebene Datei nicht finden.
        startup (1,0)-(1,0): Warning FS3005: Referenced assembly 'xxxxx\.nuget\packages\fsharp.data.sqlclient\2.0.2\lib\netstandard2.0\FSharp.Data.SqlClient.dll' has assembly level attribute 'Microsoft.FSharp.Core.CompilerServices.TypeProviderAssemblyAttribute' but no public type provider classes were found

This is only when you add the SQL Data Client package.

@matthid
Copy link
Member

matthid commented Mar 8, 2019

I guess we don't currently reference the design-time assemblies but we need to. I guess we only need to reference them and not add them to our runtime resolution...

@matthid matthid changed the title Issue with FAKE and SQL Data Client TP Reference Type Provider Reference Assemblies Mar 8, 2019
@matthid matthid changed the title Reference Type Provider Reference Assemblies Reference Type Provider Design-Time Reference Assemblies Mar 8, 2019
@matthid
Copy link
Member

matthid commented Mar 8, 2019

Apparently the compiler even tried to load xxxxx\.nuget\packages\fsharp.data.sqlclient\2.0.2\lib\netstandard2.0\FSharp.Data.SqlClient.DesignTime.dll is that not the correct place? Where is that thing?

@isaacabraham
Copy link
Contributor Author

Just checked - there's no such file in that folder. There are other instances of that file across the nuget package, but not in there.

@matthid
Copy link
Member

matthid commented Mar 8, 2019

afaik it was specced somewhere, I always thought this logic made it into the compiler but maybe it was added to the SDK. This would mean we would need to add it to FAKE internal logic as well..

@isaacabraham
Copy link
Contributor Author

@matthid I'm starting to think that this isn't actually a FAKE issue at all. If I run dotnet build on the project itself (directly from the command line), the project fails to build with the same issue. However, if I run msbuild directly after this, it works.

Of course running MSBuild from clean fails with the good old missing assets.project.json issue.

@matthid
Copy link
Member

matthid commented Mar 12, 2019

@isaacabraham tbh I have no idea how msbuild would be related to this. There is no msbuild in fake afaik :)

@isaacabraham
Copy link
Contributor Author

Yeah. I meant that this might be something relating to the type provider and dotnet tooling itself - which the FAKE script calls.

@dsyme
Copy link
Collaborator

dsyme commented Apr 11, 2019

F# tooling expects only references to TPRTC assemblies. It will find the TPDTC itself

Please ping me if you have more questions. The spec is at https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1003-loading-type-provider-design-time-components.md

@dsyme
Copy link
Collaborator

dsyme commented Apr 11, 2019

Just checked - there's no such file in that folder. There are other instances of that file across the nuget package, but not in there.

I think this may be incorrect layout of the fsharp.data.sqlclient nuget. Could you list out the layout of the package?

@matthid
Copy link
Member

matthid commented Apr 12, 2019

looks like this:

$ tree
.
├── FSharp.Data.SqlClient.nuspec
├── [Content_Types].xml
├── _rels
├── lib
│   ├── net40
│   │   ├── FSharp.Data.SqlClient.DesignTime.dll
│   │   ├── FSharp.Data.SqlClient.DesignTime.pdb
│   │   ├── FSharp.Data.SqlClient.XML
│   │   ├── FSharp.Data.SqlClient.dll
│   │   ├── FSharp.Data.SqlClient.pdb
│   │   ├── Microsoft.SqlServer.TransactSql.ScriptDom.dll
│   │   └── Microsoft.SqlServer.Types.dll
│   ├── netstandard2.0
│   │   ├── FSharp.Data.SqlClient.XML
│   │   ├── FSharp.Data.SqlClient.dll
│   │   └── FSharp.Data.SqlClient.pdb
│   └── typeproviders
│       └── fsharp41
│           ├── net40
│           │   ├── FSharp.Data.SqlClient.DesignTime.dll
│           │   ├── FSharp.Data.SqlClient.DesignTime.pdb
│           │   ├── Microsoft.SqlServer.TransactSql.ScriptDom.dll
│           │   └── Microsoft.SqlServer.Types.dll
│           └── net461
│               ├── FSharp.Data.SqlClient.DesignTime.dll
│               ├── FSharp.Data.SqlClient.DesignTime.pdb
│               ├── Microsoft.SqlServer.TransactSql.ScriptDom.dll
│               └── Microsoft.SqlServer.Types.dll
└── package
    └── services
        └── metadata
            └── core-properties
                └── 928527dbe8f24408a2058b0f11208f0b.psmdcp

12 directories, 21 files

@matthid matthid added extern and removed bug labels Apr 14, 2019
@matthid
Copy link
Member

matthid commented Apr 14, 2019

Looking over this it feels like an external bug/limitation in the FSharp.Data.SqlClient package. In fact for this to work with FAKE I think it needs to ship a DesignTime assembly for netstandard2.0

@sergey-tihon
Copy link
Member

not sure it issues are related, but I also cannot use TP (FSharp.Data) from FAKE
but in my case it looks like issues come from embedded Paket.Core
#2396

@matthid
Copy link
Member

matthid commented Sep 24, 2019

@sergey-tihon

Can you provide a small sample to reproduce?
Also have you deleted 'build.fsx.lock'? (sorry but this is a very common issue)

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

4 participants