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

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.

 

0
steven
1/5/2007 12:29:22 PM
asp.net.vs2005-webapp-projects 1239 articles. 0 followers. Follow

8 Replies
1792 Views

Similar Articles

[PageSpeed] 30
Get it on Google Play
Get it on Apple App Store

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


http://www.NetBrainer.com
0
mkamoski
1/5/2007 2:22:36 PM

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.

0
steven
1/5/2007 3:41:11 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

 


http://www.NetBrainer.com
0
mkamoski
1/5/2007 6:20:10 PM
I find the answer:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=397923&SiteID=1
0
Johnson_wei
2/16/2007 2:06:04 AM

Hi, I'm not really that experienced but i had a similar error. I created an web part application, and i wanted to reference a windows applicetion exe file that i compiled on a different project. After reading this post I played around with the advise here and did a couple of things different and my project worked.

Note that I was using VS 2005 

step 1. I created a publiic/private key as provided above...

step 2. Opened the project i wanted to reference, right-clicked on the class library of that project and clicked on properties.

step 3. Clicked on the signing tab, check the "Sign the assembly" and on the "Choose a strong name key file:" browse to the path where you created the public/private key. e.g C:\Temp\sgKey.snk

step 4. Compile your project and you might be ok... i know i wasBig Smile

0
Pagial
10/8/2008 11:16:40 AM

this is greate man !!

the best answer was the simplest

thank u

 

It worked for meBig Smile

0
duke_saeed
3/23/2009 3:11:58 PM

 That worked for me.  Pagial, you simply the best! :)

0
vejula
4/24/2009 7:38:08 AM

nice code

0
purkar
4/24/2009 11:39:38 AM
Reply:

Similar Artilces:

Generating PowerBuilder .NET assemblies failed.
could someone tell me what could be the problem to get this error when I compile? Thanks Not much to go on there... there should be a deploylog.out in the pb2csdotnettempout directory that will contain more and hopefully better information. On 14 Nov 2007 10:44:03 -0800, "TRAX" <luciano@nospam.com> wrote: >could someone tell me what could be the problem to get this error when I >compile? > >Thanks > That's the worst thing it says the same thing in the deploylog. /******** An internal exception was thrown. c:\inetpub\wwwroot\tr...

Develop in .NET 3.5...Deploy on .NET 3.0...Assembly strong name issue in web.config
Hi. I develop locally using web developer express 2008. I have .NET 3.5 installed on the development machine.I am trying to deploy to a Windows Server 2003 machine running.NET 3.0.Not surprisingly, I get an error about the strong assembly names referenced all over my web.config when I try to access the site on the production server.I don't think any of my code truly relies on .NET 3.5--it should all be compatible with the 3.0 framework.Here's my error message:Parser Error Message: Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77...

Using .NET assembly when no Strong Name is needed
I am using CB2009. I have read the article here, http://edn.embarcadero.com/article/32754 It says "An assembly is not required to be in the GAC if it is in the system or application path, and the strong name is only required if it is in the GAC, but this is the preferred method of using an assembly as a COM object." The .NET assembly I need to use is in my main program folder so it looks like I don't need the Strong Name. I would like to ask if there is a different set of instructions written for CB2009 users that describes how to use a .NET assembly when the assembly i...

COM Inerop issue with strong named assemblies in .NET 1.1
we are using EXCEL com interop in the .NET 1.1 class library project. it is working fine, if .NET assembly is not strong named. but if we make that assembly strong named, it is giving compilation error like EXCEL should be strong named. We signed EXCEL using tlbImp tool. But it is of no use. because it is generating dll rather than EXE. When we invoke this newly genarated dll, it is throwing run time error. it is giving object set to null reference error. Any help will be appreciated. Thanks in AdvanceRaj Hi, Do you meet the following error: "Referenced assembly Interop.Excel do...

differences between COM assemblies and .NET assemblies?
Hi What is the difference between COM assemblies and .NET assemblies? RegardsKaran         RegardsKaran GuptaFor .net,Javascript and Sql server articles and interview question visithttp://guptakaran21.googlepages.com/main Hi Should I make my query more clear   Regards Karan RegardsKaran GuptaFor .net,Javascript and Sql server articles and interview question visithttp://guptakaran21.googlepages.com/main Hi Karan, In my opinion, COM component is written by unmanaged code, and .NET assembly is written by managed code. Managed code runs...

Strong Naming my assembly
Hi, I am trying to use a third party control in a sharepoint web part. However, i keep getting the error when i try to compile: Referenced assembly does not have a strong name i followed the directions in this link, however its not working: http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q313666 i know that the third party dll is not strong named, and then my sharepoint dll is strong named. Is there anything else i can do to get this to work? So I just tried to use the gacutil utility to add my 3rd party user controls dll to the GAC. I get this error: Fai...

strong name to assembly
HiI want to associate strong name to the assembly. For that I have created a private/public key value pair sn -k Test.snk Now I want to associate key with the assembly.In the article http://www.codeguru.com/columns/experts/article.php/c4643/It is written that to associate key with the assembly you have to add an attribute in assemblyinfo.cs[assembly: AssemblyKeyFile("Test.snk")] But there is one more way to associate key with the assembly as shown in the figure[Image]http://guptakaran21.googlepages.com/GAC5.JPG [/Image]Is the both approaches same. Kindly adviceRegardsKaran&nbs...

Strong Named Assemblies
I have just taken over a very complex solution, which consistst of lots of projects, which would not usually phase me but it uses STRONG NAMED ASSEMBLIES, which I have no experience in.  When I try to rebuild I get the following error Assembly generation failed -- Referenced assembly 'assemblyname' does not have a strong name and then a ton of namespace can not be found errors.  Does anyone have any ideas?...

Strong Named Assemblies
Does anyone know how to sign a pre-compiled assembly with your own key? For example, if you purchase a component (without source) and you want to reference it in your personal application but can't becuase it is not strong named. Thx, JS I would ask the company who built the component for a signed version, otherwise I'd disassemble/decompile it, add a key and then rebuild. ...

Strong Assembly names
When I have multiple classes in a Business Logic Layer, do I have to include the strong name file (assemblyname.snk) in every class file or just once?Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replies as "Answer". Hi JohanNL, Do you mean that you're compiling multiple dll's from the different classes in your Business Object Layer? Noop, I compile all classes (1 class per file) into one assembly.Johan TheunissenMCPD, MCSE, MCTS BizTalk 2006==============================Please mark the most helpful reply/replie...

Strongly Named Assemblies
Hi, I am in the process of learning ASP.Net with C# and need to strongly name and assembly so that it can be loaded into the GAC.Once I have a key pair from sn.exe, do I retain the pair for all my assemblies from now till eternity, or should I generate a new key pair for each assembly to be named? I guess that because the strong name is used for publisher authenticity the key should be stored in a safe place and used to sign everything that we produce? Thanks in advanceTim  Sharper Tutorials - Learn ASP.Net, ADO.Net and the .Net Framework with C#. You will likely only need o...

strong naming Assembly
  Hi, I need to sign my assemby with a strong name i am referencing some other dlls for my asssembly. In this case when Compile my assmebly with strong name it shows the following eror Error 123 Assembly generation failed -- Referenced assembly  'Entity' does not have a strong name  Entity is an assembly I am refering it is not signed . Do I need to sign all assemblies which I am Refering? If so , what should I do if i need to use an assembly developed by another person which is not signed Regards jereesh      CAUSEloadTOCNode(1, ...

New Project type for VS2005
This is interesting: I'm facing a few issues with ASP.NET 2.0 and DNN 4.0 and how best to maintain two codelines and deploy source and non-source modules: http://weblogs.asp.net/scottgu/archive/2005/12/07/432630.aspx This project type will be a bridge between the old and the new and make migration to the new compilation a lot easier I think. Rodney Try this link... http://webproject.scottgu.com/VisualBasic/Migration/Migration.aspx Hum... looks like there are now 3 ways to go instead of 2. Kind of v 5.0.0 in sight ?    www.dotnetnuke.fr No, for now, the core ...

VS Project "File or assembl name {name}.dll, or one of its dependencies, was not found.
I'm trying to make a fix in our website project, but in the middle of all the mumbo jumbo I reinstalled my Windows XP operating system (professional).  Now, I've got VS 2008 Standard, and VS 2003 .Net installed.  I'm trying to make some immediate fixes using VS2003 and make live, before I start working on upgrading to VS 2008 (for 3.5 framework).  Everything is happening as you'd expect.  I'm getting an error that I can't get figured out.  Ideas? When I keep trying, it just changes the .dll file in the error, which is due to being part of a T...

How to use VB.Net Files in C# Project and Compile All project to Only One Assembly File.?
Hi all,I have a Library of Useful Functions and procedures But in VB.Net Language(*.vb not *.dll).All the time i have to Add additional Project to my current Project and add that VB.Net Library to it ,Then Compile it and Reference it to  my C# project and use it .so as a consequence,After Compilation in the "Bin" directory i have additional assembly Related to that VB.Net Class Library rather than one.I want to know is there any way to Achieve only One Assembly Not Two. Thanks In Advance.Regards.Nothing Is Quite Impossible !!!...

Web resources about - Assembly generation failed -- Referenced assembly does not have a strong name - asp.net.vs2005-webapp-projects

Star Trek: The Next Generation - Wikipedia, the free encyclopedia
Star Trek: The Next Generation (often abbreviated to TNG ) is an American science fiction television series created by Gene Roddenberry as part ...

Generation ranked: GPY&R research finds constant tracking of today's teens
When advertising and marketing firm GPY&amp;R delved into the lives of 14- to 17-year-olds, they discovered a generation driven by metric analysis ...

Four things making Generation-Z miserable
Australian scientist have identified four things that will make Generation Z miserable for decades to come.

Port lease deal steals from future generations
Deals are being done that will affect the bay, neighbouring communities and road networks.

Canberra woman allegedly assaulted by three generations of her own family
... and bruises to her head. A Canberra woman suffered cuts to her arm and face and a bruised head after she was allegedly assaulted by three generations ...


The Content Coattails of the Digital Generation and 5 Ideas To Do Better
I really miss the days when we all still created a lot of original stuff. I don’t blog as much as I used to, but I still love the idea of forming ...

What is Generation Alpha? - Business Insider Deutschland
Generation Alpha is going to change everything.

New efforts to inspire next generation of pilots - Videos - CBS News
Many regional airlines are struggling to fill the cockpit due in part to the high costs of flight school. While JetBlue is launching a training ...

Did CleanTechnica Push The US EIA To Include Distributed Solar Generation In Monthly Reports?
Approximately one year ago, I decided to start adding small-scale solar generation (mostly rooftop solar generation) estimates to the electricity ...

Resources last updated: 12/15/2015 6:22:13 AM