I have sql server 2008r2. According to my internet research it supports .net framework 4.0. I tried to install my assembly with sql clr functions and receved an error.
CREATE ASSEMBLY for assembly 'MyAssembly' failed because the assembly is built for an unsupported version of the Common Language Runtime.
select * from sys.dm_clr_properties
CLR is initialized
I check C:\Windows\Microsoft.NET\Framework64\ to be sure and found v4.0.30319 folder where. So, .net v4.0 is installed.
So, I need to change CLR version that used for sql. I tried
sp_configure 'clr enabled', 0; GO RECONFIGURE; GO sp_configure 'clr enabled', 1; GO RECONFIGURE; GO
It did not help. I tried to add sqlservr.exe.config with content
<configuration> <startup> <requiredRuntime version="v4.0"/> </startup> </configuration>
to C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn folder and restart sql server. It didn't help as well.
I know about option with creating registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\OnlyUseLatestCLR and setting it to 1. It can broke other solutions, so I affraid of using it on production.
Is where any suggestions how to convince sql server to use clr v4.0?