Microsoft KB Archive/216124

= BUG: Reinstalling a VB App Fails To Replace a Text File With The Same Date =

Article ID: 216124

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q216124



SYMPTOMS
If you install a Visual Basic 6.0 application that includes a text file (or any file that does not have a version number) in the distribution set, and reinstall the application without removing it first, the following warning message is displayed:

A file being copied is older than the file currently on your system. It is recommended that you keep your existing file.



CAUSE
The Visual Basic 6.0 application setup program incorrectly assumes that the text file on the system is newer than the one in the distribution set, even though the files have the exact same date.



RESOLUTION
The warning message is caused by the following statement in the CopySection Sub in the basSetup1 module of the Setup Toolkit project (Setup1.vbp):

If sFile.varDate <= FileDateTime(strDestDir & strDestName) Then

Because text files do not have version numbers, the dates are being compared. For the file to be installed, setup checks the date of that file in Setup.lst and sees if it is less than (<) or equal to (=) the date of the destination file (that is being overwritten in this case). If this statement is TRUE, it warns the user that the file being copied is older than the file on the system. As can be seen, the equal sign (=) causes the problem. If we change the "<=" to just "<" as in the following code segment, the error message will not be shown:

If sFile.varDate < FileDateTime(strDestDir & strDestName) Then

NOTE: You will need to recompile the Setup1.exe file after making the modification to the Setup Toolkit project (Setup1.vbp), and then you need to re-run the Project and Deployment Wizard (PDW) to recreate the application setup files.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior

 * 1) Create a new Standard EXE project in Visual Basic. Form1 is created by default.
 * 2) Select Make Project1.exe from the File menu to compile the project.
 * 3) Use Notepad to create a text file called test1.txt.
 * 4) Click the Start button, and then point to Programs. Select Microsoft Visual Basic 6.0, and choose Package and Deployment Wizard from Microsoft Visual Basic 6.0 Tools.
 * 5) Browse to Project1 and select Package to build the distribution set for the project.
 * 6) In the "Included File" screen, click Add to activate the Add Files dialog. Browse to test1.txt and add it to the set. Click Next for the following screens to finish building the set.
 * 7) Install the distribution set onto a target computer twice, without removing the application between installations. The above error message will be displayed the second time the setup program is run.

