I have a CLR Package made using VB.NET in Visual Studio 2012 that I'm trying to deploy to a SQL Server 2012 database. The solution has two projects, one that will be the CLR and another that is referencing a Web Service. Anytime I try to deploy to SQL, I get the following error
(47,1): SQL72014: .Net SqlClient Data Provider:
Msg 6211, Level 16, State 1, Line 1
CREATE ASSEMBLY failed because type 'SSRSService.ReportExecutionService.ReportExecutionService' in safe assembly 'SSRSService' has a static field '__ENCList'. Attributes of static fields in safe assemblies must be marked readonly in Visual C#, ReadOnly in Visual Basic, or initonly in Visual C++ and intermediate language.
An error occurred while the batch was being executed.
I've already ensured that the project has the Permission level UNSAFE and that TRUSTWORTHY is ON for the SQL Server.
The weird thing is that the field it's claiming to be the problem doesn't even exist! The project that it's complaining about only contains a Web Service reference and nothing more.
I've been able to solve the problem. I had missed a single step when I made the reference from the Startup project to the Web Service project.
All I had to do was expand the References node in the Project Explorer for the Startup project and select the Project Reference. From there, go to the Properties window and set the property Permission Set to Unsafe.