Solved

Strong Naming a third party Assembly

Posted on 2004-08-12
6
912 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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!

 
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

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.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

615 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