PRB: "Assembly Generation Failed" Error Message When You Try to Build a Managed DLL Without a Strong Name (313666)
The information in this article applies to:
- Microsoft Windows .NET Framework 1.1
- Microsoft .NET Framework 1.0
This article was previously published under Q313666 SYMPTOMS When you try to compile a managed assembly that references
a COM Interop assembly or any another managed assembly that does not have a
strong name, you may receive the following error message: Assembly generation failed -- Referenced assembly
'Interop.Project1' does not have a strong name CAUSE When you compile an assembly with a strong name, any
referenced assemblies must also have strong names. RESOLUTION To resolve the issue when you reference a COM Interop
assembly, follow these steps: NOTE: To resolve the issue when you reference a managed assembly that
does not have a strong name, you must rebuild the assembly with a strong name. Microsoft Visual C# .NET If a Visual C# .NET project references the COM Interop assembly,
the COM Interop assembly is generated for you when you reference the COM
dynamic-link library (DLL). You can specify the wrapper assembly key file in
the Visual C# project properties as follows:
- In Microsoft Visual Studio .NET, open the properties of the
Visual C# project in which you want to reference the COM component.
- In the tree, click Common Properties, and then click General.
- In the Wrapper Assembly Key File field, add the key file.
- Rebuild the project.
Microsoft Visual Basic .NET If a Visual Basic .NET project references the COM Interop
assembly, you must manually generate the COM Interop assembly with Tlbimp.exe,
as follows:
- In Microsoft Visual Studio .NET, open the properties of the
Visual Basic project in which you want to reference the COM
component.
- Delete the existing reference to your COM
component.
- Run Tlbimp.exe from a command prompt on your COM DLL to
generate an Interop assembly that has a strong name, as follows:
tlbimp.exe MyCOMDLL.dll /keyfile:KeyFile.snk /out:MyCOMInterop.dll - Add a reference to the output file from Tlbimp.exe to your
Visual Basic .NET project.
- Rebuild the project.
If the assembly is delay signed instead of fully signed, the
wrapper assembly must be delay signed. To create an assembly that is delay
signed, generate the wrapper by using the TlbImp.exe tool. To do this,
follow the previous steps. If you use the "Microsoft Visual Basic .NET" steps, modify the command line that is provided in step 3 as follows: tlbimp.exe MyCOMDLL.dll /delaysign /publickey:PublicKeyFile.snk
/out:MyCOMInterop.dll STATUS This behavior is by design.
Modification Type: | Major | Last Reviewed: | 1/27/2004 |
---|
Keywords: | kbCOMInterop kberrmsg kbprb KB313666 |
---|
|