Microsoft KB Archive/814744

= You receive an &quot;Unable to build custom action&quot; error message when you build a Setup project =

Article ID: 814744

Article Last Modified on 5/16/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.0
 * Microsoft Visual Studio .NET 2002 Academic Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Professional Edition

-



SYMPTOMS
When you open an existing Microsoft Visual Studio .NET Setup project with custom actions that refer to detected dependency files, and you try to rebuild the project, you receive the following error:

Unable to build custom action named ' ' because it references an object that has been removed from the project.



WORKAROUND
To work around this problem, exclude the existing detected dependency, and then add the same dependency as a file. To do this, follow these steps:
 * 1) In Solution Explorer, expand Setup1.
 * 2) Expand Detected Dependencies.
 * 3) Right-click MyTestLibrary.dll, and then click Exclude.
 * 4) In Solution Explorer, right-click Setup1, point to Add, and then click File.
 * 5) Locate MyTestLibrary.dll, and then click to select it. Click Open.
 * 6) On the View menu, point to Editor, and then click Custom Actions.

Custom Actions Editor is displayed.
 * 1) Right-click MyTestLibrary.dll, and then click Delete.
 * 2) Right-click Install, and then click Add Custom Action.
 * 3) Locate and then select the file that is added in step 5, and then click OK.
 * 4) In Solution Explorer, right-click Setup1, and then click Build.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Microsoft Visual Studio .NET (2003).



Steps to Reproduce the Behavior

 * 1) In Visual Studio .NET, create a Class Library project named MyTestLibrary by using Visual Basic .NET or Visual C# .NET.

By default, Class1 is created.
 * 1) Rename the solution Solution1.
 * 2) In Solution Explorer, right-click MyTestLibrary, and then click Build.
 * 3) In Solution Explorer, right-click Solution1, point to Add, and then click New Project.
 * 4) Click to select Windows Application, and then click OK to add WindowsApplication1 to Solution1.
 * 5) In Solution Explorer, right-click WindowsApplication1, and then click Add Reference.
 * 6) Click Browse. Locate MyTestLibrary.dll, and then click to select it.
 * 7) Click Open, and then click OK.
 * 8) In Solution Explorer, right-click WindowsApplication1, and then click Build.
 * 9) Right-click Solution1, point to Add and then click New Project.
 * 10) Click to select Setup Project, and then click OK to add Setup1 to Solution1.
 * 11) In Solution Explorer, right-click Setup1, point to Add, and then click Project Output.
 * 12) Under Project, click to select WindowsApplication1 in the Add Project Output Group dialog box.
 * 13) Click to select Primary Output, and then click OK.

MyTestLibrary.dll is added under Detected Dependencies.
 * 1) On the View menu, point to Editor, and then click Custom Actions.

The Custom Actions Editor is displayed.
 * 1) Right-click Install, and then click Add Custom Action.
 * 2) Locate the detected dependency MyTestLibrary.dll, and then click to select it. Click OK.
 * 3) In Solution Explorer, right-click Setup1, and then click Build.
 * 4) Close and reopen Solution1.
 * 5) In Solution Explorer, right-click Setup1, and then click Build.

You receive the error mentioned in the &quot;Symptoms&quot; section of this article.

