title: SQLCLR using the wrong version of the .NET Framework
body: <p>During a recent restart of our development server the <code>SQL Server</code> started using <code>.NET 4.0</code> for the SQLCLR. This means that nothing using the CLR in SQL works, or at least that's my understanding by reading these sources:</p>
  
  <p><a href="http://software.intel.com/en-us/blogs/2009/10/16/sql-server-2008-sqlclr-net-framework-version/" rel="noreferrer">http://software.intel.com/en-us/blogs/2009/10/16/sql-server-2008-sqlclr-net-framework-version/</a></p>
  
  <p><a href="http://www.sqlskills.com/BLOGS/BOBB/post/On-SQL-Server-and-NET-40.aspx" rel="noreferrer">www.sqlskills.com/BLOGS/BOBB/post/On-SQL-Server-and-NET-40.aspx</a></p>
  
  <p>All we get are error messages of this type:</p>
  
  <blockquote>
    <p>Msg 6517, Level 16, State 1, Line 1 Failed to create AppDomain
    "xxx.dbo[ddl].3".  Method's type signature is not Interop compatible.</p>
  </blockquote>
  
  <p>Running the statement (as suggested by @john-christensen)</p>
  
  <pre><code>select * from sys.dm_clr_properties
  </code></pre>
  
  <p>results in the following information:</p>
  
  <pre><code>*Name*      *Value*
  directory   C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
  version     v4.0.30319
  state       CLR is initialized
  </code></pre>
  
  <p>Does anyone know how to solve this or how we can force SQL Server CLR to use an earlier version of the Framework?</p>