none
Create Assembly from .NET dll

    Question

  • I am using a the SharpSvn dll open source.  I want to deploy it through a CLR function, but I first need to manually create it in sql server on the database so I can reference the dll in my CLR project.  I have searched around intensively and could not find a solution to work.  This is what I am attempting:

    USE MyDb

     

    ALTER DATABASE MyDb SET TRUSTWORTHY ON

     

    CREATE ASSEMBLY SharpSvn

    FROM 'C:\SharpSvn\SharpSvn.dll'

    WITH PERMISSION_SET = UNSAFE

    This is the error that occurs:

     

    Msg 6218, Level 16, State 3, Line 2

    CREATE ASSEMBLY for assembly 'SharpSvn' failed because assembly 'SharpSvn' 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

     

    Any tips would be greatly appreciated.  Thanks

    Wednesday, November 25, 2009 9:17 PM

All replies

  • This error message usually means that the DLL is not a Windows DLL. Can you
    recompile it with a .NET compiler and try again?

    Cheers,
    Bob Beauchemin
    SQLskills

    Wednesday, November 25, 2009 10:11 PM
    Moderator
  • It is a windows dll.  It is an open source API provided by collabnet.   http://sharpsvn.open.collab.net/
    Wednesday, November 25, 2009 10:36 PM
  • Is it a .NET DLL or a "native" DLL? Can you open it in .NET reflector and
    see? (.NET reflector will open .NET DLLs but not native DLLs) Or give me a
    link to the exact DLL (the link you provided is a general information page)
    you downloaded and I'll have a look.

    Cheers,
    Bob Beauchemin
    SQLskills

    Thursday, November 26, 2009 12:02 AM
    Moderator
  • Tuesday, December 01, 2009 1:24 AM
  • I'm getting the same error you are when using create assembly. I can open
    the asssembly in reflector (i.e. it is a .NET assembly) but it is also
    statically linked with some native DLLs (and an exe) as resources. It
    appears that this is not supported for create assembly processing.

    Hope this helps,
    Bob Beauchemin
    SQLskills

    Tuesday, December 01, 2009 5:13 AM
    Moderator
  • Do you have any furhter ideas of how I can work around this issue? 
    Tuesday, December 01, 2009 5:42 PM
  • You'd need to recompile and relink the DLL, using only the C++ compiler
    switches that are supported for assemblies to be used with SQL Server.
    Unfortunately, these aren't well documented anywhere that I'm aware of
    (although you could search the questions on this forum related to C++ and
    SQLCLR). I'm thinking that it has to be a C++ compiler issue as the .NET
    lC.DLL (the .NET/C/C++ interop DLL). An
    easier workaround might be to move your version control processing to the
    middle tier.

    Hope this helps,
    Bob Beauchemin
    SQLskills

    • Marked as answer by KJian_ Monday, December 07, 2009 9:30 AM
    • Unmarked as answer by ML90 Thursday, December 17, 2009 12:41 AM
    Tuesday, December 01, 2009 6:40 PM
    Moderator
  • I've done my searching around for a while now and was not able to use your solution.  Is there anybody else that has faced my problem before and has come up with a solution? 

    UPDATE:
    After using suggestions from the following blog, I was able to reference the dlls and build succesfully, but failed during deployment
    http://sqlblogcasts.com/blogs/nielsb/archive/2004/09.aspx

    The error during deployment is:

    Error 1 Assembly 'sharpsvn, version=1.6006.1373.40218, culture=neutral, publickeytoken=d729672594885a28.' was not found in the SQL catalog. 
    Thursday, December 17, 2009 12:41 AM
  • Are you using SQL Server Express?
    Tuesday, December 22, 2009 7:45 PM
  • Hi,
    I have created .net(c#, Framework 4.0) application using SharpSvn.dll
    It runs fine on my IIS.
    When it is loaded on live, it gives the error like
    "Unable to find assembly 'SharpSvn, Version=1.7002.1998.12257, Culture=neutral, PublicKeyToken=d729672594885a28'."
    Dont know the reason what is happening.
    i have referenced SharpSvn.dll in my Application and it automatically adds the other two named
    1. SharpSvn-DB44-20-Win32.dll
    2. SharpSvn-SASL21-23-Win32.dll
    and one of its exe file.
    I am using SharpSvn to commit files.
    It is creating SharpSvn.SvnClient Object successfully, but when it tries to perform the SvnClient.Update(file) it get the error like mentioned above. 
    Code:


    SvnClient client = new SvnClient();
    client.Authentication.DefaultCredentials = new NetworkCredential(repoid, repopassword);
    client.LoadConfiguration(commitPath, true);
    log.Info("Going To Update Retrieved File");  //this line gets executed fine and i m geting log in my logfile
    client.Update(file); 
    SvnAddArgs saa = new SvnAddArgs();
    saa.Force = true;
    saa.Depth = SvnDepth.Infinity;
    log.Info("Going to Add In Svn"); // but i m not getting this log in my log file


    If anyone has faced problem like this and come with solution please help.
    Its urgent.
    Tuesday, March 06, 2012 11:09 AM