Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a small dll made in Managed C++, not mine. I can't compile my solution because it says that that assembley must be strong name. I can't recompile it so is the a solution to strong name already compiled dll. Thanks in advance.

[Edit - Moved from answer by OP - Henry]
(Don't know should I post here. Working from mobile ) The libary is mixed mode , so ilasm doesn't work. I need it for my shell extension so it needs to be registrated in GAC. Is there a posability to create some kind of wraper to call a dll outiside of GAC. Either way thanks all , nice comunity didn't expect answer so fast.
[/Edit]
Posted
Updated 14-Feb-11 10:40am
v2

This [^]should help you.
 
Share this answer
 
Comments
Nish Nishant 14-Feb-11 11:24am    
May not work for a mixed mode DLL.
Sergey Alexandrovich Kryukov 14-Feb-11 11:27am    
5 Anyway. (I don't know if OP requires mixed mode.)
--SA
Nish Nishant 14-Feb-11 11:33am    
Consider it's MC++ it's highly likely that it's mixed mode.
Henry Minute 14-Feb-11 16:41pm    
The OP has responded with an answer. I have moved it into the question.
Do you still use Managed C++? It is obsolete now, replaced with C++/CLI.

You really want to use strong names for all assemblies, by many reasons.
The problem is that once you referenced strong-named assembly, it pulls all other assemblies to get a strong name.

If you don't have access to source code, it still can be signed.
Make a key using sn, ildasm and ilasm with the key.
sn -k 2048 key.snk
ildasm myAssembly.dll /out:MyAssembly
ilasm myAssembly /key:key.snk /dll /output:myNewAssembly.dll


It may not work with mixed-mode library (managed+unmanaged).

—SA
 
Share this answer
 
v4
Comments
Nish Nishant 14-Feb-11 11:32am    
SA, the OP has stated that he does not have access to the source code. So I don't think that article will help him.
Sergey Alexandrovich Kryukov 14-Feb-11 11:39am    
Oh, thank you...
--SA
Sergey Alexandrovich Kryukov 14-Feb-11 11:50am    
See fixed Answer. Thank you very much again.
--SA
Nish Nishant 14-Feb-11 11:52am    
That will only work if the MC++ DLL was compiled as pure IL. If it's mixed mode with unsafe calls into native code, it's unlikely that the author can get this working as he wants to. I assume he's trying to use the DLL with CAS requirements and that's failing because of all the native code. But definitely worth a try I guess.
Sergey Alexandrovich Kryukov 14-Feb-11 12:08pm    
Sure, I agree; I noted this problem in my Answer.
Well, do you know the way to sign a mixed-mode library, not using source code?
I don't know, quick search did not give me anything good...
--SA
I suppose this dll was working before & suddenly it stopped working in your project.I would suggest,you clean the projects, remove bin and all references to DLLs and add them again.Rebuild your application and run.It may resolve.If this doesnt work,you can try using strong name signing tools like sn.exe
 
Share this answer
 
Comments
Nish Nishant 14-Feb-11 11:49am    
I am sorry but this answer does not apply to the OP's question at all. Please read the other answers posted here, and the comments in those answers.
Anupama Roy 14-Feb-11 12:04pm    
Appreciate your prompt response! I have read the question as well as the answers.I have provided my suggestion to OP.I answered in that way because I beleive the cleaning of solution & referencing dlls again may solve the error that says assembly must be strong name.If doesnt,then only need to think about converting it to strong name.
Nish Nishant 14-Feb-11 12:08pm    
The OP does not have source access to this DLL, which is most likely a mixed mode DLL that was written using the now obsolete MC++ syntax. MC++ DLLs are very hard to sign because they are not fully MSIL. Even with C++/CLI unless the assembly was compiled with the pure or safe compiler switches, it's very hard or even impossible to have it strongly named.

Cleaning the solution, removing and reading references etc. will be quite unlikely to be of help in this situation. I already commented this to the other two responders, so I was surprised to see a 3rd response on similar lines.

I appreciate the fact that you are trying to help but sometimes it's best not to dilute the responses by posting redundant information that has a very low likelihood of helping the OP. Thanks.
Sandeep Mewara 14-Feb-11 14:05pm    
I agree on first half of the comment but have a little different thinking on the last part :)

I found that, when we are facing some issue, at that time we are ready to try any and everything that might help.

Surely the current response is of not much of use as the source code of dll is not there but in general if an answer has any likelihood to help, I would like to listen.

And now I know, you would not agree on this :) and its fine as this is totally based on individuals. Just wanted share... :)
Anupama Roy 14-Feb-11 23:38pm    
Thanks for sharing your thoughts :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900