Kirupananthan.G.S
Kirupananthan.G.S

Reputation: 265

CLR Assembily creation error

I was created one CLR assembly in SQL server 2012. It shows the below error.. Please advise on the below error

Assembly 'ElasticSearchCLR' references assembly 'system.data.linq, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.', 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.

thanks in advance Kirupa

Upvotes: 0

Views: 1638

Answers (1)

Solomon Rutzky
Solomon Rutzky

Reputation: 48874

Instead of copying system DLLs into your project folder, just import the first library that it says is missing (i.e. use CREATE ASSEMBLY ...). Since it imports related libraries in the same folder, any libraries related to the first .NET Framework library will most likely be in that same .NET Framework version folder. So you should only need to manually import the libraries that you added as references, and their dependencies, if any, will in most cases be resolved automatically.

With regards to the final error stated in the comments on the question, assuming that you are trying to import the correct version (including 64 bit vs 32 bit) of the System.ServiceModel.Internals library, then you might just need to specify WITH PERMISSION_SET = UNSAFE when you are importing it: Failed to create assembly 'System.ServiceModel.Internals' in SQL.

Upvotes: 0

Related Questions