Solved

Strong Naming a third party Assembly

Posted on 2004-08-12
6
899 Views
Last Modified: 2007-12-19
I have an assembly that needs to be registered in Enterprise Services. Because of this, it is strongly named. It needs to have a reference to a third party assembly that is not strongly typed. I obviously have problems compiling as is. Is there any way to strongly name a third party assembly to which I don't have the source?

-Simon
0
Comment
Question by:swex
  • 4
  • 2
6 Comments
 
LVL 2

Accepted Solution

by:
davidastle earned 500 total points
ID: 11787387
Decompile their dll!

Well, seriously, this is probably easier than what you have to do...

As an example, we will create two DLL assemblies.  One will represent your DLL, and the other will represent the third parties DLL.  We will call yours "mine.DLL" and theirs "theirs.DLL"
Lets put everything in the same path for simplicity and call it C:\MyPath

I assume you already have a key and know how to sign your assembly from .NET  ... if not I can tell you that later

Lets call your key mykey.snk, and store it at C:\MyPath\MyKey.snk

now, go to start -> search -> for files and folders, and search for ILDASM.exe
When your search finds it, remember the folder name.  Now go to start -> run ->, type in cmd, and hit enter
Now change the directory to the directory in which ILDASM is stored by typing in cd <directory path> (c:\Program Files\Microsoft Visual Studio .NET 2004\SDK\v1.1\Bin on my computer)

Now, type in (without quotes) "ILDASM C:\MyPath\theirs.DLL /out C:\MyPath\theirs.IL"
This will create MSIL source code for their dll.  Do not close your command console yet

Now, go back to your serach, and search for ILasm.exe
Now go back to your command console, and type in cd <directory path> (C:\WINNT\Microsoft.NET\Framework\v1.1.4322\ on my computer)

Now type in "ILasm /DLL /KEY=C:\MyPath\MyKey.snk C:\Maya\theirs.IL"
This will create a new dll file with the same name as the IL file (theirs.DLL)  And sign it with the specified key.

Now, go back to your project, and set the assembly options to sign with the same key as their assembly if you add a reference to their DLL, it will now compile because it is strong named with the same key!

You should have decompiled...
0
 
LVL 2

Assisted Solution

by:davidastle
davidastle earned 500 total points
ID: 11787409
Oh, and make sure you keep a backup of their DLL... i just realized that this will overwrite their DLL if it is in the same directory of the IL file and has the same name
0
 

Author Comment

by:swex
ID: 11787927
Just as a note, the line you have as:
ILDASM C:\MyPath\theirs.DLL /out C:\MyPath\theirs.IL
should really read:
 ILDASM C:\MyPath\theirs.DLL /out=C:\MyPath\theirs.IL

I'm thinking about this a bit more, and I don't think it's going to work for my purposes, I have to interact with this DLL as it runs within IIS as an application, I'm curious as to the downstream DLLs this guy will require.

You answered my question perfectly though and I'm sure it will come in handy later.

Do you know what would happen if I did the following:

- compile two DLLs (a and b) and a made reference to b
- decompile a (into IL) and recompile adding a key to strongly type
- allow a.dll to lazily register in Enterprise services and make use of it
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 2

Expert Comment

by:davidastle
ID: 11788676
no I don't know if that would work... but it sounds like a nice idea!
0
 
LVL 2

Expert Comment

by:davidastle
ID: 11793926
Did it work?
0
 

Author Comment

by:swex
ID: 11793934
I'll let you know for sure once I try it on the webserver, I might have to strong-name a few.

-sw
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
send messages to whatsapp programatically 2 44
Keyboard 2 32
Adding  DYMO Labelprinter to c# client application 4 28
HttpPostedFile 1 26
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now