Create Assembly from .NET dll
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
November 25th, 2009 9:17pm
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
November 25th, 2009 10:11pm
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
November 26th, 2009 12:02am
December 1st, 2009 1:24am
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
December 1st, 2009 5:13am
Do you have any furhter ideas of how I can work around this issue?
December 1st, 2009 5:42pm
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
December 1st, 2009 6:40pm
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.aspxThe error during deployment is:
Error1Assembly 'sharpsvn, version=1.6006.1373.40218, culture=neutral, publickeytoken=d729672594885a28.' was not found in the SQL catalog.
December 17th, 2009 12:41am
Are you using SQL Server Express?
December 22nd, 2009 7:45pm
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.
March 6th, 2012 11:09am
CREATE ASSEMBLY SharpSvn
FROM 'C:\SharpSvn\SharpSvn.dll'
WITH PERMISSION_SET=EXTERNAL_ACCESS
Check and conform.
The library, System.Environment, is not supported for CLR: http://msdn.microsoft.com/en-us/library/ms403279.aspx
------------------------------------------
Mark it answer ,will help others.
-
Proposed as answer by
Dinesh Vishe
16 minutes ago
April 15th, 2015 2:53am