SqlDataConnection type provider generates massive

2019-07-31 19:08发布

问题:

For some reason, I can't create a type provider for a particular database. I have code which looks a bit like this (not the actual database names, obviously):

type db1 = SqlDataConnection<"Data Source=SQL_05;Initial Catalog=**DATABASE1**;Integrated Security=true;MultipleActiveResultSets=True">
type db2 = SqlDataConnection<"Data Source=SQL_08;Initial Catalog=**DATABASE2**;Integrated Security=true;MultipleActiveResultSets=True">
type db3 = SqlDataConnection<"Data Source=SQL_10;Initial Catalog=**DATABASE3**;Integrated Security=true;MultipleActiveResultSets=True">

The first 2 lines are totally fine, my program was working fine as long as those were the only databases I needed. However, once I added the third line, I got a single, huge error along these lines:

The type provider 'Microsoft.FSharp.Data.TypeProviders.DesignTime.DataProviders' reported an error:  
tmp7AA1.cs(12,7): warning CS0437: The type 'System' in '...\AppData\Local\Temp\tmp7AA1.cs' conflicts with the imported namespace 'System' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll'. Using the type defined in '...\AppData\Local\Temp\tmp7AA1.cs'.
tmp7AA1.cs(88967,22): (Location of symbol related to previous warning)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll: (Location of symbol related to previous warning)
tmp7AA1.cs(12,7): error CS0138: A using namespace directive can only be applied to namespaces; 'System' is a type not a namespace
tmp7AA1.cs(88967,22): (Location of symbol related to previous error)tmp7AA1.cs(13,7): 
warning CS0437: The type 'System' in '...\AppData\Local\Temp\tmp7AA1.cs' conflicts with the imported namespace 'System' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll'. Using the type defined in '...\AppData\Local\Temp\tmp7AA1.cs'.
tmp7AA1.cs(88967,22): (Location of symbol related to previous warning)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll: (Location of symbol related to previous warning)
tmp7AA1.cs(88967,31): error CS0246: The type or namespace name 'INotifyPropertyChanging' could not be found (are you missing a using directive or an assembly reference?)
tmp7AA1.cs(88967,56): error CS0246: The type or namespace name 'INotifyPropertyChanged' could not be found (are you missing a using directive or an assembly reference?)
tmp7AA1.cs(13,14): error CS0426: The type name 'Collections' does not exist in the type 'System'
tmp7AA1.cs(14,7): warning CS0437: The type 'System' in '...\AppData\Local\Temp\tmp7AA1.cs' conflicts with the imported namespace 'System' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll'. Using the type defined in '...\AppData\Local\Temp\tmp7AA1.cs'.
tmp7AA1.cs(88967,22): (Location of symbol related to previous warning)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Configuration.dll: (Location of symbol related to previous warning)
tmp7AA1.cs(14,14): error CS0426: The type name 'ComponentModel' does not exist in the type 'System'

And so on, for 116460 lines!

I can connect to each server in SSMS to verify that these connection strings work. Here's what I see:

  • SQL_05 is version 10.0.2531 (SQL Server 2008)
  • SQL_08 is version 10.0.2500 (SQL Server 2008)
  • SQL_10 is version 10.50.4286 (SQL Server 2008 R2)

Other than this, I can't see any difference between the three servers. Is there something I'm missing here? Do I need to add some reference to be able to create a type provider for this particular server?