1

I have a c# class library which is called by SQL stored procedure (CLR). The class library performs some calculations and returns a table back to SQL.

I have added assemblies to SQL before, however when i was adding the class library. I get the following error

'MyExporter' references assembly 'microsoft.csharp, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request. 

I did a bit of research and found out that SQL does not support Microsoft.charp library. I need to remove any references to microsoft.charp in my class library. I have now removed microsoft.charp from the reference section in my class library and I was using dynamic keyword. Which i have now changed to object.

Currently, I get a error in my C# library as follows

Severity Code Description Project File Line Suppression State Error CS0656 Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.Binder.Convert' Optimal.SynTI.Exporter D:\Workspace\SynTQV5 Projects\MyExporter\DataCollater.cs 731 Active 

I understand this one line of code is not going to give you any insight, but this is where the c# error lies

// Select the first item as the sheet ID. // Get the Sheet Id from the array. iNVls.SheetID = item.FinalData[0].Value; 

I also am using Linq in my class library, do i have to remove any references to linq as well?

Thank you

10
  • Do you get the error when compiling, or when you call the SQLCLR procedure? Commented Dec 19, 2016 at 14:53
  • Possible duplicate of Sql Server CLR load assembly failed Commented Dec 19, 2016 at 14:57
  • when i compile my c# class library Commented Dec 19, 2016 at 15:01
  • .. in which case, it sounds like you have something left over which wants to reference Microsoft.CSharp Commented Dec 19, 2016 at 15:03
  • Juan - I have gone through that link you specified before. I understand Microsoft.Charp cannot be installed into SQL and I have already installed system.web successfully. Thank you. Commented Dec 19, 2016 at 15:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.