Feb 11, 2014

Deploy error SQL01268: .Net SqlClient Data Provider: Msg 6212, Level 16, State 1, Line 1 CREATE ASSEMBLY failed because method '' on type '' in safe assembly '' is storing to a static field. Storing to a static field is not allowed in safe assemblies.


When we will deploy a CLR objects like CLR stored procedures, CLR data types etc from visual studio we may get error message like:

Deploy error SQL01268: .Net SqlClient Data Provider: Msg 6212, Level 16, State 1, Line 1 CREATE ASSEMBLY failed because method '' on type '' in safe assembly '' is storing to a static field. Storing to a static field is not allowed in safe assemblies.

Solution:

Set the permission level of your project unsafe. For this select Database tab in properties window of your project and choose Permission level Unsafe.


Now build the project solution.

1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from .Net Core Training in Chennai. or learn thru .Net Core Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
    or Es6 Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete