We are having problems creating an assembly in our database and need some assistance. We have two .NET 2.0 assemblies (ABC.Company.App1.dll and ABC.Company.App2.dll). Both assemblies only have references to System, System.Data, and System.XML. ABC.Company.App1.dll also references ABC.Company.App2.dll.
We’re trying to create the ABC.Company.App1.dll assembly using:
CREATE ASSEMBLY App1
AUTHORIZATION dbo
FROM 'C:\ApplicationPath\ABC.Company.App1.dll'
WITH PERMISSION_SET = SAFE
GO
Note both assemblies are in C:\ApplicationPath.
But this fails. The error is:
Msg 10300, Level 16, State 1, Line 21
Assembly ‘ABC.Company.App1’ references assembly ‘ABC.Company.App2, version=0.0.0.0, culture=neutral, publickeytoken=null.’, 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: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.
What’s the problem? How can we fix this?
The version of ABC.Company.App2 is definitely not 0.0.0.0. We’ve tried creating the ABC.Company.App2 assembly into our database first, which succeeds, but trying to create ABC.Company.App1 assembly still fails. A little more info. We’ve tried with PERMISSION_SET = SAFE, UNSAFE, and EXTERNAL_ACCESS, none of which work. And, these DLLs are not strongly named and are not registered in the GAC.
Help?!
Thanks!
Sounds like you are trying to create assembly ABC.Company.App1.dll which references ABC.Company.App2.dll but, since ABC.Company.App2.dll hasn’t been created yet, you’re getting an error. Try creating ABC.Company.App2.dll first.