none
Delay signing a C# using command prompt and Al.exe RRS feed

  • Question

  • Hi,

    I am having an C# exe which i want to delay sign using command prompt. But while searching on the web the only option i found is using assembly linker or al.exe. But problem is i am having a key but dont know how to use it with al and visual studio command prompt. i tried few options but all were fail. Can anyone help me with this.

     

    Thanks,

    Nikhil.

    • Moved by spacewrangler Saturday, September 3, 2011 2:26 PM (From:Building Development and Diagnostic Tools for .Net)
    Friday, September 2, 2011 12:26 PM

Answers

  • To create and sign an assembly with a strong name using the Assembly Linker

    • At the command prompt, type the following command:

      al /out:<assembly name> <module name> /keyfile:<file name>

      In this command, assembly name is the name of the assembly to sign with a strong name, module name is the name of the code module used to create the assembly, and file name is the name of the container or file that contains the key pair.

    The following example signs the assembly MyAssembly.dll with a strong name using the key file sgKey.snk.

    al /out:MyAssembly.dll MyModule.netmodule /keyfile:sgKey.snk


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Tuesday, September 13, 2011 9:09 AM
    Tuesday, September 6, 2011 8:21 AM
  • Hi,

    Please refer this,

     

    http://www.andrewconnell.com/blog/archive/2004/12/15/772.aspx

    But for the option using prebuild exe file we are losing ICON for the file don't know the reason why. But it works.

    Thanks,

    Nikhil.

    • Marked as answer by Paul Zhou Tuesday, September 13, 2011 9:09 AM
    Monday, September 12, 2011 6:00 AM

All replies

  •  

    Hi,

     

    Do you mean sign an assembly with strong name? if yes, you can refer to the links below:

    How to: Sign an Assembly with a Strong Name

    How to: Sign an Assembly (Visual Studio) 

     

    I hope this can help you.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, September 5, 2011 9:30 AM
  • Hi Paul,

           Actually my problem is I only have the generated *.exe of C# code and one public key through which i have to generate delay sign builds after which the owner of private key can sign it. The links you have provided talks about using AL i think which requires *.cs file as well.

                   Can you please help me in that terms.

     

    Thanks,

    Nikhil.

    Monday, September 5, 2011 12:29 PM
  • Hi Nikhil,

    If you mean a .snk file to sign the assembly, you can sign it in VS IDE.

    Open project properties->signing->sign the assembly->choose the key file.


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, September 6, 2011 7:03 AM
  • Hi Paul,

    I don't have code with me. I only have .snk file and end exe file, and also visula studio 2010 command prompt.

     

    Thanks,

    Nikhil.

    Tuesday, September 6, 2011 8:02 AM
  • To create and sign an assembly with a strong name using the Assembly Linker

    • At the command prompt, type the following command:

      al /out:<assembly name> <module name> /keyfile:<file name>

      In this command, assembly name is the name of the assembly to sign with a strong name, module name is the name of the code module used to create the assembly, and file name is the name of the container or file that contains the key pair.

    The following example signs the assembly MyAssembly.dll with a strong name using the key file sgKey.snk.

    al /out:MyAssembly.dll MyModule.netmodule /keyfile:sgKey.snk


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Paul Zhou Tuesday, September 13, 2011 9:09 AM
    Tuesday, September 6, 2011 8:21 AM
  • Hi Paul,

    Thanks for your reply but i have went through this option but failed can you just take a effort to show me what is exactly the third parameter <module name> .

    Thanks,

    Nikhil.

     

    Tuesday, September 6, 2011 8:25 AM
  • Hi,

    You need to general the modele file using .cs file firstly.

    csc /t:module YourClass.cs

    Then using the command in my last post to sign the assembly.

    More information, you can refer to:

    http://stackoverflow.com/questions/4372908/what-is-the-module-name-when-using-al-exe-to-sign-an-assembly-with-a-strong-nam


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, September 8, 2011 7:56 AM
  • Hi,

    Please refer this,

     

    http://www.andrewconnell.com/blog/archive/2004/12/15/772.aspx

    But for the option using prebuild exe file we are losing ICON for the file don't know the reason why. But it works.

    Thanks,

    Nikhil.

    • Marked as answer by Paul Zhou Tuesday, September 13, 2011 9:09 AM
    Monday, September 12, 2011 6:00 AM