0

I am using Microsoft enterprise library in one of my projects. I need to strong name one of the dlls which is Microsoft.Practices.EnterpriseLibrary.Common. But it is not working.

When I decompile using ILDASM, it generates 3 files.

  1. IL file
  2. .RESOURCES file
  3. Common resource script file

How do I compile it with the key file. Which ILASM command should I use?

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

The dll's are distributed from the original install in a few different modes. One set of files is already signed, so you need to find that set and use the files from that set.

When you install the EntLib package, you get the compiled binaries (some are signed) AND you get the source code, which compiles the source-code and creates the dlls (not signed).

My guess is that you are using the non-signed (compiled from the source code on your local machine) files, instead of the signed ones.

granadaCoder
  • 26,328
  • 10
  • 113
  • 146
  • yes i am using the compiled source code because i have added some changes to the downloaded enterprise library code. And i need to use only few dlls from entlib from this compiled(non-signed) code. So, i wish to strong name each of them using ildasm & ilasm. Will this work? – user3740952 Jun 17 '14 at 18:52
  • So you want to sign your modified and compiled code? You're not Microsoft, so you'll have to use your own key. Is that what you're talking about? If you have the source code (that you have modified), then why are you decompiling. Let me say this another way, you cannot sign the code (the default code or your slightly modified code) "just as if" Microsoft was signing it. Because if you could, you could write malicious code and then pass it off as a Microsoft assembly. – granadaCoder Jun 17 '14 at 18:56
  • But i want to copy the dlls that i am using to GAC. Also i don't want to use unsigned dlls in the server. Surely, there should be some way of doing it. Can you pl help! – user3740952 Jun 17 '14 at 19:12
  • You have the source-code that you've modified. Compile it and sign it. Treat the code as if you owned it, since you've modified it. http://msdn.microsoft.com/en-us/library/xc31ft41%28v=vs.110%29.aspx – granadaCoder Jun 17 '14 at 19:19
  • i did the same but using sn.exe. And it did'nt work. That is i was able to generate the strongly named dll. But referencing that into my project gave build error. got this error: Could not load file or assembly ... A strongly named assembly is required Anyway thanks for your help. I will try this and get back to you. – user3740952 Jun 17 '14 at 19:29
  • Can you post how the references are made, by opening up the .csproj file (or similar) in notepad. – granadaCoder Jun 17 '14 at 19:49
  • I chose the first option mentioned in the link posted by you "To create and sign an assembly with a strong name by using Visual Studio". It works great. But which mode is should set in visual studio, while compiling the project -- Debug or release. Please clarify. Thanks... – user3740952 Jun 22 '14 at 13:54
  • That question is outside the scope of what the exact thing you're doing. But you can look here: http://stackoverflow.com/questions/90871/debug-vs-release-in-net At the end of the day, they're just pre-built-in configurations that have different options enabled. But if you're deploying/packing your product, go with Release mode I guess. – granadaCoder Jun 23 '14 at 13:07
  • OK. Thank you. you answered all my queries. – user3740952 Jun 29 '14 at 17:17
  • If you're at a point of understanding the issue, the "etiquette" thing to do would be to mark one of the answers ..as... "the answer". so this question does not keep coming up on Not-Answerered SOF queries. – granadaCoder Jun 30 '14 at 12:58