Unable to emit assembly: <error message>

The Visual Basic compiler calls the Assembly Linker (Al.exe, also known as Alink) to generate an assembly with a manifest, with the linker reporting an error in the emission stage of creating the assembly.

Error ID: BC30145

To correct this error

  1. Examine the quoted error message and consult the topic Al.exe Tool Errors and Warnings for further explanation and advice.

  2. Try signing the assembly manually, using either the Assembly Linker (Al.exe) or the Strong Name Tool (Sn.exe).

  3. If the error persists, gather information about the circumstances and notify Microsoft Product Support Services.

To sign the assembly manually

  1. Use the Strong Name Tool (Sn.exe) to create a public/private key pair file.

    This file has a .snk extension.

  2. Delete the COM reference that is generating the error from your project.

  3. From the Windows Start menu, point to Programs, point to Microsoft Visual Studio 2008, point to Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

  4. Move to the directory where you want to place your assembly wrapper.

  5. Type the following code.

    tlbimp <path to COM reference file> /out:<output assembly name> /keyfile:<path to .snk file>
    

    An example of the code you might enter would be the following.

    tlbimp c:\windows\system32\msi.dll /out:Interop.WindowsInstaller.dll /keyfile:"c:\documents and settings\mykey.snk"
    

    Use double quotation marks (") if a path or file contains spaces.

  6. In Visual Studio, add a .NET Assembly reference to the file you just created.

See Also

Tasks

How to: Create a Public/Private Key Pair

Reference

Assembly Linker (Al.exe)

Al.exe Tool Errors and Warnings

Strong Name Tool (Sn.exe)

Other Resources

Product Support and Accessibility