I have a F# DLL (.NET Framework 4.5.1, F# 4.1, FSharp.Core 4.4.3.0). The only NuGet added reference is to FSharp.Data.SqlProvider 1.1.41.
The code is in one file only
module DB
open FSharp.Data.Sql
[<Literal>]
let private dbVendor = Common.DatabaseProviderTypes.MSSQLSERVER
Build goes without errors
Import the built dll in SQL server as assembly
CREATE ASSEMBLY [Library2] FROM '<path>\Library2.dll' WITH PERMISSION_SET = UNSAFE
Operation fails with error
Assembly 'Library2' references assembly 'fsharp.core, version=4.3.1.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request
Now comment the last two rows in the code
//[<Literal>]
//let private dbVendor = Common.DatabaseProviderTypes.MSSQLSERVER
With this the SQL assembly creation succeeds, the assembly is correctly created in SQL server
Finally, if I downgrade the project to F# 3.1 (FSharp.Core 4.3.1.0), then no error in both cases
SQL Server 14.0.1000
Windows 10 Pro
Please note that an issue has already been raised in the project GitHub repo: Issue #541
Questions
- Does anyone see something wrong in what I am doing?
- Has anyone incurred in such an issue and solved it? If yes, how?