Microsoft Knowledge Base Email Alertz

You receive a build error message when you use the Assembly Registration tool (Regasm.exe) in Visual C#

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 908268 - Last Review: May 11, 2007 - Revision: 1.4

You receive a build error message when you use the Assembly Registration tool (Regasm.exe) in Visual C#

SYMPTOMS

When you use the Assembly Registration tool (Regasm.exe) in a pre-build event or in a post-build event in Microsoft Visual C#, you receive one of the following build error messages in the Output window:

Message 1
Performing Post-Build Event...
'regasm' is not recognized as an internal or external command,
operable program or batch file. Project error: A tool returned an error code from the build event
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(814,9): error MSB3073: The command "RegAsm.exe "[Path]\MyClassLib.dll"" exited with code 9009.

Post-Build Event failed
Message 2
Performing Pre-Build Event...
'regasm' is not recognized as an internal or external command,
operable program or batch file.
Project error: A tool returned an error code from the build event
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(814,9): error MSB3073: The command "RegAsm.exe "[Path]\MyClassLib.dll"" exited with code 9009.

Pre-Build Event failed

RESOLUTION

To resolve this problem, specify the complete path of the Regasm.exe file that is located in the Microsoft .NET Framework directory.

For example, if you are using Microsoft Visual Studio .NET 2003, use the following line of code.
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe [path of dll]\MyClassLib.dll
If you are using Microsoft Visual Studio 2005, use the following line of code.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe [path of dll]\MyClassLib.dll

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
Assembly Registration tool (Regasm.exe)
http://msdn2.microsoft.com/en-us/library/tzat5yw6(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/tzat5yw6(vs.71).aspx)

Build Events, Common Properties, <Projectname> Property Pages dialog box
http://msdn2.microsoft.com/en-us/library/aa288397(VS.71).aspx (http://msdn2.microsoft.com/en-us/library/aa288397(VS.71).aspx)
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
810230  (http://kbalertz.com/Feedback.aspx?kbNumber=810230/ ) How to implement build events in Visual C# .NET

APPLIES TO
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Express Edition
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Academic Edition
Keywords: 
kbprogramming kbbug kbtshoot kbprb KB908268
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate