Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Strong Naming a third party Assembly

Posted on 2004-08-12
6
Medium Priority
?
929 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 2000 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 2000 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month8 days, 4 hours left to enroll

824 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