locked
Strong name a manifest but not the exe RRS feed

  • Question

  • I am trying to load a thirdparty DLL which requires me (an executable) to be strong named with a provided *.snk file.  I have read that it is generally not a good idea to sign an exe therefore I am trying to find an alternative.  I want my executable to reference weak named existing assemblies and if I strong name my executable that means I won't be able to reference weak named assmeblies.  Is there a solution to this?

    I read that I can strong name a manifest as opposed to the entire exe and that means I can reference weak assmeblies as well as use the thirdparty dll which requires me to be strong named, is this at all possible?  If so how?

    I have tried generating a manifest and then embedding it etc but all in vain, need some guidance.  Thanks.


    Ruskin

    Wednesday, April 11, 2012 4:30 AM

Answers

  • First of all why do you want to sign the executable? Do you get any benifit by signing the executable?

    I read that I can strong name a manifest as opposed to the entire exe and that means I can reference weak assmeblies as well as use the thirdparty dll which requires me to be strong named, is this at all possible?  If so how?

    It is not like that. When an assembly is signed, the strong name is applied to the file containing assembly manifest (if the assembly is multifile assembly. But, if you are creating project in visual studio, it will be single file assembly, wherein only one file is present which containes the manifest too).

     


    Please mark this post as answer if it solved your problem. Happy Programming!

    • Proposed as answer by Kris Anderson Tuesday, April 17, 2012 1:54 AM
    • Marked as answer by Mike Feng Saturday, April 21, 2012 7:24 AM
    Wednesday, April 11, 2012 6:30 AM
  • Let me make it clear. Manifest doesn't exist independently, but it will be part of a module. When you strong name your aasembly, the strong name is applied to the module containing manifest.

    So, you can not just strong name the manifest. Strong naming can only be done on assembly but not just some part of it.


    Please mark this post as answer if it solved your problem. Happy Programming!

    • Proposed as answer by Mike Feng Thursday, April 12, 2012 6:05 AM
    • Marked as answer by Mike Feng Saturday, April 21, 2012 7:24 AM
    Thursday, April 12, 2012 2:00 AM

All replies

  • First of all why do you want to sign the executable? Do you get any benifit by signing the executable?

    I read that I can strong name a manifest as opposed to the entire exe and that means I can reference weak assmeblies as well as use the thirdparty dll which requires me to be strong named, is this at all possible?  If so how?

    It is not like that. When an assembly is signed, the strong name is applied to the file containing assembly manifest (if the assembly is multifile assembly. But, if you are creating project in visual studio, it will be single file assembly, wherein only one file is present which containes the manifest too).

     


    Please mark this post as answer if it solved your problem. Happy Programming!

    • Proposed as answer by Kris Anderson Tuesday, April 17, 2012 1:54 AM
    • Marked as answer by Mike Feng Saturday, April 21, 2012 7:24 AM
    Wednesday, April 11, 2012 6:30 AM
  • Sorry I don't follow the reasoning.

    I want to strong name the exe as I *have to* because I am using a thirdparty dll which requires all callers to contains its snk file.

    I thought I could strong name the manifest of the exe file and that way I can still use other weak named assemblies but I am not sure how to do that or even if that is possible?!

    Thanks.


    Ruskin

    Wednesday, April 11, 2012 11:03 PM
  • Let me make it clear. Manifest doesn't exist independently, but it will be part of a module. When you strong name your aasembly, the strong name is applied to the module containing manifest.

    So, you can not just strong name the manifest. Strong naming can only be done on assembly but not just some part of it.


    Please mark this post as answer if it solved your problem. Happy Programming!

    • Proposed as answer by Mike Feng Thursday, April 12, 2012 6:05 AM
    • Marked as answer by Mike Feng Saturday, April 21, 2012 7:24 AM
    Thursday, April 12, 2012 2:00 AM
  • Not sure if you read the link to the article I posted but this is what it says:

    ---------------------------------------------------------------------------

    What Can Be Strong-Named

    You can strong-name .NET Framework assemblies and XML manifests. These include the following:

    • Application Assemblies (.exe)

    • Application Manifests (.exe.manifest)

    • Deployment Manifests (.application)

    • Shared Component Assemblies (.dll)

    ---------------------------------------------------------------------------

    So I don't want to strong name my exe, I want to strong name my .exe.manifest, how can I do that?!


    Ruskin

    Tuesday, April 17, 2012 4:17 AM
  • Ok.. I understand your confusion.

    .exe.manifest is something like configuaration file and it is a seperate file. Through this file you can configure some behaviors of your application. If you want to deploy only this file to GAC, then this file must be seperatly strong named. Strong naming this file doesn't have any effect on the assembly which consumes this .exe.manifest file.

    On the other hand, assembly manifest is something like header of the assembly, which containes information about the assembly. When you strong name the assembly, the strong name information is stored in this manifest. This manifest will always be part of the assembly.

    Similar description holds good for .application (deployment manifests) as well where these are also seperate files like .exe.manifest.


    Please mark this post as answer if it solved your problem. Happy Programming!

    Tuesday, April 17, 2012 4:51 AM
  • I am still not sure if I buy that explanation, the article explicitly says that if you want to use weak named dlls in a strongly named exe then you should only sign the manifest and not the entire exe...

    Ruskin

    Saturday, April 21, 2012 8:27 AM