BUG: Visual Studio .NET Setup Projects Execute Custom Action of Previous Version when Upgrading

Article translations Article translations
Article ID: 555184 - View products that this article applies to.
Author: Carlos Quintero MVP
Expand all | Collapse all

SUMMARY

When you install a new version of an application whose setup includes a custom install action, the installer doesn’t execute the custom install action of the new version but the one of the previous version, which is being replaced.

SYMPTOMS

When you execute a setup created by a Visual Studio .NET Setup Project to upgrade an application and the setup includes a custom install action, the installer doesn’t execute the custom install action of the new version but the one of the previous version, which is being replaced.

CAUSE

This seems to be a bug of Visual Studio .NET.

MORE INFORMATION

Steps to reproduce the problem:
 
- Create a new Visual Studio .NET 2003 Class Library project using VB.NET and name it ClassLibrary1.
 
- Add references to System.Windows.Forms.dll and System.Configuration.Install.dll assemblies.
 
- In the AssemblyInfo.vb file, change <Assembly: AssemblyVersion("1.0.*")> to <Assembly: AssemblyVersion("1.0.0.0")>
 
- In the AssemblyInfo.vb file, add <Assembly: AssemblyFileVersion("1.0.0.0")>
 
- Modify the Class1 class of the class library to look like this:
 
<System.ComponentModel.RunInstaller(True)> _
Public Class Class1
    Inherits System.Configuration.Install.Installer
 
    Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)
        System.Windows.Forms.MessageBox.Show("Install from 1.0")
    End Sub
 
    Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary)
        System.Windows.Forms.MessageBox.Show("Uninstall from 1.0")
    End Sub
 
End Class
 
- Add a Setup Project to the solution named Setup1.
 
- Right-click the solution node in the Solution Explorer, select Configuration Manager and mark the Build checkbox of the Setup project.
 
- Right-click the solution node in the Solution Explorer, select Project Dependencies and select that Setup1 project depends on ClassLibrary1 project.
 
- Select the setup project in the Solution Explorer and in the Properties window change RemovePreviousVersions to True.
 
- Right-click the setup project in the Solution Explorer, select Properties and change Bootstrapper from "Windows Installer Bootstrapper" to "None".
 
- In the File System Editor of the setup project, select Application Folder, right-click Add, Project Output, and select the Primary Output of ClassLibrary1.
 
- In the Custom Actions Editor of the setup project, right-click on Install node, select Add Custom Action, enter in Application Folder and select "Primary output from ClassLibrary1 (Active)".
 
- In the Custom Actions Editor of the setup project, right-click on Uninstall node, select Add Custom Action, enter in Application Folder and select "Primary output from ClassLibrary1 (Active)".
 
- Save all changes and Build the solution.
 
- Run the Setup1.msi installer which has been created, selecting "Just Me". At some point, you get the message "Install from 1.0" of the install custom action.
 
- Now, in the AssemblyInfo.vb file, change <Assembly: AssemblyFileVersion("1.0.0.0")> to <Assembly: AssemblyFileVersion("2.0.0.0")>.
 
- In Class1, change the messages to "Install from 2.0" and "Uninstall from 2.0"
 
- Select the setup project in the Solution Explorer and in the Properties window change Version to 2.0.0. You will be prompted to change the Product Code and Package Code. Click Yes to accept the changes.
 
- Save all changes and Build the solution again.
 
- Run the Setup1.msi installer which has been created, selecting "Just Me" again and using the same destination folder. At some point, you get the message "Uninstall from 1.0" of the uninstall custom action of the first version, which is correct. But later, a message "Install from 1.0" appears, instead of the expected "Install from 2.0".
 
 

 

Properties

Article ID: 555184 - Last Review: August 24, 2004 - Revision: 1.0
APPLIES TO
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2003 Professional Edition
Keywords: 
kbpubmvp kbpubtypecca kbhowto KB555184
COMMUNITY SOLUTIONS CONTENT DISCLAIMER
MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com