After SQL Client of SQL Server 2012 is installed to the client computer which also have Visual Studio 2010 installed, I am excited about deploying CLR with .NET 4.0. I launched Visual studio, started a Visual C# CLR database Project, created a simple CLR project, deploy, and then failed. Tried again, and failed again…
The error message is
The following error might appear if you deploy a SQL CLR project that was built for a version of the .NET Framework that is incompatible with the target instance of SQL Server: “Deploy error SQL01268: CREATE ASSEMBLY for assembly failed because assembly failed verification”. To resolve this issue, open the properties for the project, and change the .NET Framework version.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlClr.targets(96,5): Deploy error SQL01234: The database version is not supported.
I changed different version of .Net in the project. But it could not help.
Finally I figured that all CLR projects templates supporting prior SQL Server 2012 do not support SQL Server 2012. Microsoft SQL Server Data Tools has to be used. This tool is not installed by default. You have to go to New Project -> Other Languages -> SQL Server -> Microsoft SQL Server Data Tools.
Follow the instruction, have it installed:
Then you can create CLRs for SQL 2012 using integrated environment. For the projects created using old templates, you can convert them by right clicking on yor proceject then Convert to SQL Server Database project…