HOW TO: Upgrade a Nonversioned File That Is Included in a Setup Project by Using Microsoft Visual Studio .NET (827027)
The information in this article applies to:
- Microsoft Windows Installer
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2002), Academic Edition
SUMMARYThis 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: 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: back to the topRequirementsThis 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 topCreate a Nonversioned FileTo 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 topCreate a Setup Project to Install the Nonversioned FileTo create a Setup project that installs the nonversioned file
on your computer, follow these steps:
- Start Microsoft Visual Studio .NET.
- On the File menu, point to
New, and then click Project.
- In the New Project dialog box, click
Setup and Deployment Projects under Project Types.
- Under Templates, click
Setup Project, and then click OK.
By default, Setup1 is created.
- In Solution Explorer, right-click Setup1,
point to Add, and then click File.
- In the Add Files dialog box, locate the
Testfile.txt file in the C:\UpgradeFiles folder.
- Click Testfile.txt, and then
click Open.
- In Solution Explorer, right-click Setup1,
and then click Build.
back to the
topInstall the Nonversioned FileTo install the nonversioned file on your computer, follow these steps:
- Locate the Setup1.msi file in the
Path of Setup1\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. - Right-click Setup1.msi, and then click
Install.
- On the Welcome to the Setup1 Setup Wizard
page, click Next.
- On the Select Installation Folder page,
type C:\NonVFiles in the Folder text box,
and then click Next.
- On the Confirm Installation page, click
Next.
- On the Installation Complete page, click
Close.
- 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
topUpgrade the
Nonversioned File by Using the Setup ProjectTo 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. - In the Properties window of
Setup1, set the RemovePreviousVersions
property to True.
- Set the Version property to
1.0.1.
- In the Microsoft Development Environment
dialog box, click Yes.
- In Solution Explorer, right-click Setup1,
and then click Build.
- Locate the Setup1.msi file in the
Path of Setup1\Debug folder on your computer.
Note If you installed the Testfile.txt file on a different computer, copy Setup1.msi to that computer. - Right-click Setup1.msi, and then click
Install.
- On the Welcome to the Setup1 Setup Wizard
page, click Next.
- On the Select Installation Folder page,
type C:\NonVFiles in the Folder text box,
and then click Next.
- On the Confirm Installation page, click
Next.
- On the Installation Complete page, click
Close.
- 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.
back to the
topREFERENCESFor more information, visit the following Microsoft
Developer Network (MSDN) Web site: back to the
top
Modification Type: | Minor | Last Reviewed: | 5/23/2005 |
---|
Keywords: | kbHOWTOmaster kbhowto kbfile kbAppSetup kbUpgrade kbsetup kbDeployment KB827027 kbAudDeveloper |
---|
|
|
©2004 Microsoft Corporation. All rights reserved.
|
|