Microsoft KB Archive/827027

= HOW TO: Upgrade a Nonversioned File That Is Included in a Setup Project by Using Microsoft Visual Studio .NET =

Article ID: 827027

Article Last Modified on 4/12/2007

-

APPLIES TO


 * Microsoft Windows Installer 2.0
 * Microsoft Visual Studio .NET 2003 Enterprise Architect
 * Microsoft Visual Studio .NET 2003 Enterprise Developer
 * Microsoft Visual Studio .NET 2003 Academic Edition
 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-



IN THIS TASK

 * SUMMARY
 * Requirements
 * Create a Nonversioned File
 * Create a Setup Project to Install the Nonversioned File
 * Install the Nonversioned File
 * Upgrade the Nonversioned File by Using the Setup Project
 * REFERENCES



SUMMARY
This step-by-step article describes how to upgrade a nonversioned file during a Microsoft Windows Installer package installation. In the sample, you add a nonversioned file to the Windows Installer package by using a Microsoft Visual Studio .NET Setup project.

Windows Installer upgrades the nonversioned file while the Windows Installer package is running. When Windows Installer starts to install the nonversioned file that you added to the Visual Studio .NET Setup project, the installer searches for a file in the destination folder that has the same name as the file that you want to install.

If Windows Installer locates a file in the destination folder that has the same name as the file that you want to install, the installer compares the following properties of the two files:
 * Version
 * Date
 * Language

Windows Installer uses the file versioning rules to determine whether to install the file that is included in the package.

However, if both the file in the destination folder and the file in the installation package are nonversioned files, Windows Installer compares the Create dates and the Modified dates of these files to determine whether to upgrade the nonversioned file.

For more information about file versioning rules, visit the following Microsoft Developer Network (MSDN) Web site:

http://msdn2.microsoft.com/en-us/library/aa368599.aspx

back to the top

Requirements
This article assumes that you are familiar with the following topic:

Visual Studio .NET Setup Projects

The following list outlines the recommended hardware, software, network infrastructure, and service packs that you need:
 * Microsoft Windows 2000, Microsoft Windows XP, or Microsoft Windows Server 2003
 * Microsoft Visual Studio .NET

back to the top

Create a Nonversioned File
To create a nonversioned file such as a text file, follow these steps:  On drive C of your computer, create a folder that is named UpgradeFiles. In the UpgradeFiles folder, create a new text file that is named Testfile.txt. Add the following statement to the file:

This is a nonversioned text file.

 Save and then close the file.

back to the top

Create a Setup Project to Install the Nonversioned File
To create a Setup project that installs the nonversioned file on your computer, follow these steps:
 * 1) Start Microsoft Visual Studio .NET.
 * 2) On the File menu, point to New, and then click Project.
 * 3) In the New Project dialog box, click Setup and Deployment Projects under Project Types.
 * 4) Under Templates, click Setup Project, and then click OK. By default, Setup1 is created.
 * 5) In Solution Explorer, right-click Setup1, point to Add, and then click File.
 * 6) In the Add Files dialog box, locate the Testfile.txt file in the C:\UpgradeFiles folder.
 * 7) Click Testfile.txt, and then click Open.
 * 8) In Solution Explorer, right-click Setup1, and then click Build.

back to the top

Install the Nonversioned File
To install the nonversioned file on your computer, follow these steps:
 * 1) Locate the Setup1.msi file in the  \Debug folder on your computer.

Note If you want to install the Testfile.txt file on a different computer that has the Microsoft .NET Framework 1.0 or the .NET Framework 1.1 installed, copy Setup1.msi to that computer.
 * 1) Right-click Setup1.msi, and then click Install.
 * 2) On the Welcome to the Setup1 Setup Wizard page, click Next.
 * 3) On the Select Installation Folder page, type C:\NonVFiles in the Folder text box, and then click Next.
 * 4) On the Confirm Installation page, click Next.
 * 5) On the Installation Complete page, click Close.
 * 6) In Windows Explorer, locate the Testfile.txt file in the C:\NonVFiles folder. Double-click Testfile.txt to open the file and view the statement, and then close the file.

back to the top

Upgrade the Nonversioned File by Using the Setup Project
To upgrade the nonversioned file while you are installing the Windows Installer package, follow these steps:  In Solution Explorer of the Setup1 project, right-click Testfile.txt, and then click Open. In the Testfile.txt file, replace the existing statement with the following statement:

This is a modified nonversioned file.

</li> In the Properties window of Setup1, set the RemovePreviousVersions property to True.</li> Set the Version property to 1.0.1.</li> In the Microsoft Development Environment dialog box, click Yes.</li> In Solution Explorer, right-click Setup1, and then click Build.</li> Locate the Setup1.msi file in the \Debug folder on your computer.

Note If you installed the Testfile.txt file on a different computer, copy Setup1.msi to that computer.</li> Right-click Setup1.msi, and then click Install.</li> On the Welcome to the Setup1 Setup Wizard page, click Next.</li> On the Select Installation Folder page, type C:\NonVFiles in the Folder text box, and then click Next.</li> On the Confirm Installation page, click Next.</li> On the Installation Complete page, click Close.</li> In Windows Explorer, locate the Testfile.txt file in the C:\NonVFiles folder. Double-click Testfile.txt to open the upgraded file and view the new statement.</li></ol>

back to the top

<div class="references_section">