title: Unable to find the requested .NET Framework Data Provider (machine.config appears correct)
body: <p>I am trying to create a SQL CLR project (for SQL Server 2008 R2), and get "Unable to find the requested .NET Framework Data Provider".  </p>
  
  <p>I have spent over an hour googling for a solution, and most seems to be that there is an extra self-terminating  entry or a missing "SqlClient Data Provider" in the machine.config file, but I have checked and handled all of that, but still get the same message</p>
  
  <p>As a test, I created a new project and tried to use the Data Source Configuration Wizard to add a connection - same issue.  Note that I normally never use the Visual Studio wizards for connections (my Data Access Layer that handles all of that from code) - so this issue might have been there for a long time.  Same issue with both VS 2010 and VS 2013.  Project framework version: .NET 3.5.  Tried CPU Any and x86.</p>
  
  <p>As a test, I simplified my DbProviderFactories section of all machine.config files that I could find to this (removing Oracle, SQL CE, etc.):</p>
  
  <pre><code>&lt;system.data&gt;
      &lt;DbProviderFactories&gt;
         &lt;add name="SqlClient Data Provider" invariant="System.Data.SqlClient" description=".Net Framework Data Provider for SqlServer" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/&gt;
      &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
  </code></pre>
  
  <p>These are my machine.config files</p>
  
  <pre><code>C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config
  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
  </code></pre>
  
  <p>Connection string: </p>
  
  <pre><code>Data Source=x.x.x.x;Initial Catalog=SomeDB;Persist Security Info=True;User ID=sa
  </code></pre>
  
  <p>Still no go!</p>
  
  <p>Note that the connection string does not seem to matter at this point - it does not even get far enough to try connecting (the Framework Data Provider error comes up instantly).  </p>
  
  <p><strong>Need help debugging and fixing this.</strong>  </p>
  
  <p><strong>Edit 10/11/2014</strong></p>
  
  <p>Based on the article  VDohnal referred me to, I did this simple test:</p>
  
  <pre><code>try 
  {
      string provider = "System.Data.SqlClient";
      DbProviderFactories.GetFactory(provider);
      Console.WriteLine("{0} created...\n", provider);
  
      var dt = DbProviderFactories.GetFactoryClasses();
      for (int i = 0; i &lt; dt.Rows.Count; i++)
          Console.WriteLine("{0}: {1}", i, dt.Rows[i][2]);
  }
  catch (Exception ex)
  {
      Console.WriteLine(ex);
  }
  </code></pre>
  
  <p>The provider is created without issue, followed by my providers:</p>
  
  <pre><code>System.Data.SqlClient created...
  
  0: System.Data.Odbc
  1: System.Data.OleDb
  2: System.Data.OracleClient
  3: System.Data.SqlClient
  4: Devart.Data.MySql
  5: System.Data.SqlServerCe.4.0
  </code></pre>
  
  <p>Note that I added back my original DbProviderFactories entries, since this part is working.  Also, the exact machine.config file used is: C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config</p>
  
  <p>But the wizard still fails with the same error message.</p>
  
  <p>As a workaround, is there a way to create a CLR project without using the database connection wizard?  I know the somename.sqlproj.user file contains the resulting connection string, but it is encrypted, so how do I add it manually?</p>