Solved

Strong Naming a third party Assembly

Posted on 2004-08-12
6
904 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSRS subreport with parameter 3 48
VB.NET 2008 Winforms Signing 13 32
c# - Best approach for objects in functions 3 24
What are the simplest ways to create a Merge Sort? 3 29
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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…

828 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