Problem to create assembly which depends on other dll's from SQL Server
I am developing an application in .Net but I need to access to some procedures in ASP.Net since SQL Server.
I have got it but i have problems to assembly the dll if it has dependencies of another dll's.I have read that if a dll need other dll it call it automatically but when I try to assembly my class in .NET there is the next error:
Create failed for SqlAssembly 'ClaseEjemplo'.
Assembly 'csyt.dal, version=0.0.0.0, culture=neutral, publickeytoken=null.' was not found in the SQL catalog. (.Net SqlClient Data Provider)
Nevertheless if I the class hasn't another dependencies it works.The class I am trying to assembly is ClaseEjemplo.If I try to use the procedure of other class "'csyt.dal" I have problems.If ClaseEjemplo hasn't dependencies it works perfectly!
My class ClaseEjemplo is:
using System;
using System.Collections.Generic;
using System.Text;
using Csyt.DAL;
using Csyt.Info;
namespace ClaseEjemplo
{
public class Class1
{
public static long devolucion()
{
AIAlarmaDB.TipoCondicion aux1 = new AIAlarmaDB.TipoCondicion();
AIAlarmaDB aux = new AIAlarmaDB();
aux1=aux.GetTipoCondicionById(1);
return aux1.Id;
}
}
}
Thanks in advance
[1288 byte] By [
bambinor] at [2007-12-22]
The assembly I want to add from SQL Server is Csyt.DAL because I need to call a procedure of this dll but this dll use another dll like Csyt.Info.If I try to assembly directly Csyt.DAL i have the following error:
Assembly 'csyt.info, version=0.0.0.0, culture=neutral, publickeytoken=null.' was not found in the SQL catalog. (.Net SqlClient Data Provider)
If I try to assembly firstly Csyt.Info I have the following error:
Assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.' was not found in the SQL catalog. (.Net SqlClient Data Provider)
And if I try to assembly this one I obtain the following error:
Assembly 'system.drawing, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.' was not found in the SQL catalog.
Warning: The Microsoft .Net frameworks assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=x86.' you are registering is not fully tested in SQL Server hosted environment. (.Net SqlClient Data Provider)
So my problem is that I don't know if I need to install something or not because there is no way to add the assembly I want.Nevertheless If I do the assembly of a dll which doesn't depends on another one everything is ok but I need to solve the problem because it is the case I need
I am starting with this things so sorry if I insist too much but I don't know what I can do.........
Thanks again
CLR integration in SQL Server 2005 supports only a subset of .NET framework libraries to be references and used inside SQL Server. These are:
- CustomMarshalers
Microsoft.VisualBasic
Microsoft.VisualC
mscorlib
System
System.Configuration
System.Data
System.Data.OracleClient
System.Data.SqlXml
System.Deployment
System.Security
System.Transactions
System.Web.Services
System.Xml
These libraries have been tested to ensure they are reliable to run inside SQL Server. These libraries can be referenced in any code and do not have to be registered using CREATE ASSEMBLY. These are the only assemblies that SQL Server allows CLR to load from GAC. All other assemblies (within .NET framework or otherwise) need to be registered explicitly inside the database. Any code that is outside of these libraries should be tested well by the user for reliability and security.
While the assemblies you are trying to registered are not supported by CLR integration you can use them if you test your functionality well. An easy way to register system.web and all its dependencies is to register them from the .NET framework install directory (usually c:\windows\microsoft.net\framework\<version>)
e.g:
CREATE ASSEMBLY SystemWeb from 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'
with permission_set = unsafe
Since all the dependent assemblies are in the same directory, SQL Server would automatically register them.
Thanks,
-Vineet.