Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Register a C# dll

Author  Topic 

olay80
Yak Posting Veteran

62 Posts

Posted - 2005-04-26 : 08:59:03
hey guys,

well we can register a VB dll on another machine using regsvr32. in C# after doing some research it seems "RegAsm" is used to register the dll : regasm myDll.dll
it gives me registered successfuly. but it also needs to be added to the assemblies from what i read so i should put the following :
gacutil /i myDll.dll. but it keep on giving me that i should add a strong name.
does anyone have an idea?

thanx,
Oliver

mfemenel
Professor Frink

1421 Posts

Posted - 2005-04-26 : 09:06:01
A strong name can be created by using the SN tool that ships with .net. A strong name is nothing more than a fancy way of saying "unique name" for an assembly. Check out this article, it does a decent job of walking you through the steps.
http://www.dotnetspider.com/Technology/KBPages/406.aspx

Mike
"oh, that monkey is going to pay"
Go to Top of Page

olay80
Yak Posting Veteran

62 Posts

Posted - 2005-04-27 : 02:06:22
Dear Mike,

i'm just gonna go through the exact steps that i did to register the dll in the assembly:
1- regasm myDll.dll
result:Types Registered Successfuly

2- sn -k "C:\key.snk"
result:Key Pair Written to C:\key.snk

3- then i the AssemblyInfo.cs class in my project is set the following and compiled it: [assembly: AssemblyKeyFile("C:\\key.snk")]

4- gacutil /i myDll.dll
result: Assembly Successfuly Added To the Cache

if these steps are correct and the Dll is in "C:\Windows\Assembly" folder, what do i do now to register the Dll? and if that's the registration how do i call it???

thanx,
Oliver
Go to Top of Page

mohdowais
Sheikh of Yak Knowledge

1456 Posts

Posted - 2005-04-27 : 02:46:42
Oliver, do you really have a good reason to go through all the trouble it takes to globally register your DLL on the machine? The only reason you would want to do that is if you have more than one application using that DLL. Otherwise, its a lot easier for you to just copy the DLL into the bin folder of the application that needs to use it and it will be automatically made available to the app.

OS
Go to Top of Page

olay80
Yak Posting Veteran

62 Posts

Posted - 2005-04-27 : 03:14:41
hehe, you are right i can add the dll to my reference and invoke it just like a simple class.
but the problem is that our company is making dll for reports, these reports are invoked by a service that provide certain parameters for the dll to setup the connection with the database and use it's functions to generate a certain output.
they use to do it in VB (asp.net) the VB dll can be registered on the server easy(regsvr32) and the service create an object from the dll and make use of it.and the thing is that we assign the name of the DLL in a database table, the service calls it from there.
we're trying to shift to C#(.Net) and i've never used DLL s at least C# DLL s mainly classes and components...
that's why i'm going through all this trouble...:)

thanx,
Oliver
Go to Top of Page
   

- Advertisement -