0

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

5
  • It looks like you need to copy 'system.data.linq` v4.0 into the same folder where your 'ElasticSearchCLR' assembly is located. Then try re-creating the CLR assembly and CLR function. You may "fix" one error and find another. You'll have to keep repeating the steps until all "missing references" errors are resolved. Commented Aug 4, 2014 at 12:17
  • thanks... i have added the Linq and another Assembly.. after that it show the below error.. Assembly 'ElasticSearchCLR' references assembly 'smdiagnostics, 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. Commented Aug 4, 2014 at 12:23
  • Yep. As I mentioned in the first comment, you may "fix" one error and find another. You'll have to keep repeating the steps until all "missing references" errors are resolved. Good luck. Commented Aug 4, 2014 at 13:14
  • I have resolved all the error But it shows the below... i can't able to resolve it CREATE ASSEMBLY for assembly 'ElasticPatent_CLR' failed because assembly 'System.ServiceModel.Internals' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message Commented Aug 4, 2014 at 13:43
  • Take a look at this Failed to CREATE AN ASSEMBLY in SQL Commented Aug 4, 2014 at 13:48

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.