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…

Deploy CLR in SQL Server 2012

You May Also Like

8 thoughts on “Deploy CLR in SQL Server 2012

  1. Thank you so much. I was banging my head against the wall trying to figure out why my CLR would not deploy!

  2. I don’t have the Microsoft SQL Server Data Tools project template installed in my VS2010 installation. Where can I find this template?

    Thanks

  3. Hi
    I am facing the same issue for my SQL CLR projects, as we have upgraded database from SQL Server 2008 R2 to 2012.
    As per my RnD:

    CLR Version is 2.0 for SQL Server 2008 R2 and below.
    CLR Version is 4.0 for SQL Server 2012.

    In my project, I am unable to see Convert to SQL Server Database project… option on right clicking.

    Could you please give some suggestion?

    Regards
    Varun

Leave a Reply to jhara Cancel reply

Your email address will not be published. Required fields are marked *

C# | HTML | Plain Text | SQL | XHTML | XML | XSLT |

This site uses Akismet to reduce spam. Learn how your comment data is processed.