Reputation: 73303
I have a Winforms project with a single .exe file as the primary output. I'm using a deployment project to distribute it, but the .exe file is not being updated when the new version is installed, meaning I have to ask the users to manually uninstall and then install the new version.
Here's what I'm doing:
I'm sure I've done this before successfully, but I can't seem to do it now. What am I doing wrong?
Edit: I got it to work by changing the file version in the project properties, as in this answer
Upvotes: 11
Views: 8551
Reputation: 51
One additional tip: if you open the AssemblyInfo.cs file for your project, and change AssemblyVersion to
[assembly: AssemblyVersion("1.0.*")]
then the assembly version information is automatically updated each time you build the project. Then comment out or remove the AssemblyFileVersion entry from the same file, so the file version defaults the same as the assembly version. This means the file version updates automatically each time you build it so you only have to update the installer version to get files overwritten as you're expecting.
Upvotes: 5
Reputation: 3181
Finally figured this out after banging my head against the wall for hours.
My problem was identical to this one and ended up being very simple to solve. Two answers above led me in the right direction and helped me figure out my problem but here it is in a nutshell.
If you have RemovePreviousVersion set to true then the problem is most likely in the application settings under the assembly information button.
I ran the log as mohlsen showed in the answer above, msiexec /i "project.msi" /l*v "c:\install.log" and ended up with the same response, Won't Overwrite; Won't patch; Existing file is of an equal version
Inverse pointed me in the right direction but also threw me off a bit with the MFC reference. I am writing a windows app and finally put two and two together and went to the properties of the app I am writing under the Application tab. There is a button called Assembly Information that leads to the assembly version and file version. I incremented these and now my .exe file updates.
So you do have to do two things, increment the actual assembly version in the app you are writing as well as the version of the install package.
Upvotes: 6
Reputation: 4476
Your application's executable may not be updating because you did not increment the VERSION information resource in your MFC project.
It's not enough to just increment the setup project version. See below:
http://msdn.microsoft.com/en-us/library/6fkzft86.aspx
"Version information is also used by setup APIs."
Upvotes: 5
Reputation: 1900
It's hard to say what may be causing this. How are you installing the MSI that does not remove the previous version? I would recommend running the install that is not working with verbose logging. I would run it from the command line like this:
msiexec /i "project.msi" /l*v "c:\install.log"
/l tells msiexec (which is the installer service) to create a log, * tells it to log everything, and v tells it to use verbose mode.
Run that, and take a look at the log file and it should tell you what is failing and why. You can post that log file here too and I bet we can find something together.
ADDITIONL QUESTIONS: The log file makes it look like the installer thinks there is nothing to do. When you state you update the file version, what are you updating? How do you have the files included to be deployed? Do you have them included as "primary outputs" in the setup project, or are you including the assemblies directly? Do you have it determining the dependencies and automatically including them, or did you include a project output?
UPDATE See this post for a description of what needs to change to automatically upgrade MSI's. Question 511789
Upvotes: 9
Reputation: 9664
You might try doing a rebuild on the solution. You could also clean it while you're at it. I can see how this would happen if all you changed were content files. If not, then disregard.
Upvotes: 1
Reputation: 117330
Are you trying to update while the application is running? If so, it will not be possible. You need to think of a better way, like using a small external app to kill the current running process, and install the update, and restart the new version.
Upvotes: 1