Assembly generation failed -- Referenced assembly does not have a strong name

Last post 02-15-2007 9:06 PM by Johnson_wei. 4 replies.

Sort Posts:

  • Assembly generation failed -- Referenced assembly does not have a strong name

    01-05-2007, 7:29 AM

    Hi,

    I've attempted to migrate a VS2005 "Web Site Project" to "Web Application Project". I overcome all issues except 1. When i try to build my new project it compains that a referenced assembly isn't strong named. Unfortunatley this is a third party .NET assembly so it is not built as part of my solution. Both new and old web projects are instructed to be signed in the assemblyinfo.cs the old web site project compiles and publishes fine and the new one doesn't. I've read some pages that suggest i can sign my precompiled(3rd party) assembly but haven't found anything that suggests how this is done. Ultimatley i have 2 questions.

    1. What is the difference between "Site" and "Application" projects that makes this a problem for one and not the other?

    2. How do i get my new application project to build Smile

    Thanks.

    Steve.

     

  • Re: Assembly generation failed -- Referenced assembly does not have a strong name

    01-05-2007, 9:22 AM
    steven.miles:

    Hi,

    I've attempted to migrate a VS2005 "Web Site Project" to "Web Application Project". I overcome all issues except 1. When i try to build my new project it compains that a referenced assembly isn't strong named. Unfortunatley this is a third party .NET assembly so it is not built as part of my solution. Both new and old web projects are instructed to be signed in the assemblyinfo.cs the old web site project compiles and publishes fine and the new one doesn't. I've read some pages that suggest i can sign my precompiled(3rd party) assembly but haven't found anything that suggests how this is done. Ultimatley i have 2 questions.

    1. What is the difference between "Site" and "Application" projects that makes this a problem for one and not the other?

    2. How do i get my new application project to build Smile

    Thanks.

    Steve.

     

    (1)

    Web-Site Project is a project type that is built-in to VS.NET 2005. It provides a structure for building an ASP.NET web-based application. For compilation, as Web-Site Project uses the "new" compilation model for web-sites promoted by VS.NET 2005. This compilation model rests on the Precompilation of the site and it is quite different from the "old" compilation model in VS.NET 2003. There are many ways to configure Precompilation, but, in general the site compiles to >1 DLL files and 0..N content files/placeholders. It is complicated, but not too much so once you find the Precompilation configuration that you like. It can be more secure that the old VS.NET 2003 compilation model. See below for more details.

    A Web-Application Project is a project type that is provided as an add-on project type. The Web-Application Projects compile to (generally) a single-DLL and 1...N content files. It is, pretty much, the same compilation model that VS.NET 2003 used.

    (2)

    You have a good question regarding signing a single DLL file.

    Here is some information, but I got stuck trying to find the "module name", as mentioned in the MSDN help.

    Here are some of the steps.

    1. First, you need to create a Public/Private Key Pair.
    2. Choose >Start, >Programs, >Microsoft Visual Studio 2005, >Visual Studio Tools, >Visual Studio 2005 Command Prompt.
    3. Enter the following at the command prompt and then press Enter...
      sn -k C:\Temp\sgKey.snk
    4. Now the key pair is created.
    5. Next, sign the assembly, (for example  "MyAssembly.dll"), with a strong name using the key file, (for example "sgKey.snk").
    6. At that point, MSDN, says... "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."
    7. What is NOT clear to me is where one gets the "module name". Where does that come from if one is only starting with a singe file, MyAssembly.dll??? I want to type something like this...
      al /out:"c:\Temp\MyAssembly.dll" MyModule.netmodule /keyfile:"c:\Temp\sgKey.snk"
      ...but the file MyModule.netmodule does not exist. What gets used for "module name" when one starts with a single file???

    So, for question (2) I am just adding to the question and (I hope) framing it a bit --

    So that one can sign a single DLL file Assembly with the Assembly Linker (al.exe), where does one get a "module file" for the command line syntax if one is starting with just a single DLL file?

    (Note that most of the signing information above is paraphrased from MSDN.)

    For more details, check here...

    ASP.NET Web Site Precompilation -- http://msdn2.microsoft.com/en-us/library/ms228015.aspx

    How to: Create a Public/Private Key Pair  -- http://msdn2.microsoft.com/en-us/library/6f05ezxy.aspx

    How to: Sign an Assembly with a Strong Name -- http://msdn2.microsoft.com/en-us/library/xc31ft41.aspx

     

    If you or anyone finds an answer to the "when does one get the module name" question, please post it.

    Thank you.

    -- Mark Kamoski

  • Re: Assembly generation failed -- Referenced assembly does not have a strong name

    01-05-2007, 10:41 AM

    Thanks Mark,

    I understand that the the 2 projects types are different and use different build models and that it's something to do with the new build model that is causing the "Web Application Project" to have problems with my unsigned 3rd party assembly. Maybe question 1 should have been

    1. What difference in the build models causes the assembly generation failure in "Web Application Projects" and not in "Web Site Projects" when the web project is signed and references an unsigned assembly?

    I use a key (.snk) that is already generated. This is about where i got to in my search. I know how to sign an assembly if i have the source Smile. The ideal solution would be one that does not need me to sign the 3rd party assembly or does behind the scenes basically making my web application project work the same way as my web site project in this context.

  • Re: Assembly generation failed -- Referenced assembly does not have a strong name

    01-05-2007, 1:20 PM
    steven.miles:

    ...I know how to sign an assembly if i have the source Smile. The ideal solution would be one that does not need me to sign the 3rd party assembly or does behind the scenes basically making my web application project work the same way as my web site project in this context.

    Yes, that's is where I am stuck too.

    I can sign an assembly when I have the source.

    But, I cannot sign an assembly when all I have is a single DLL.

    If you find an answer, then please post it.

    I am sorry that I cannot be of more help.

    Thank you.

    -- Mark Kamoski

     

  • Re: Assembly generation failed -- Referenced assembly does not have a strong name

    02-15-2007, 9:06 PM
    I find the answer:
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=397923&SiteID=1
Page 1 of 1 (5 items)
Microsoft Communities
Page view counter