views:

1106

answers:

6

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 increment the assembly version on the output project (which is the primary output of the deployment project)
  • I increment the deployment project version (and update the product code when prompted)
  • The deployment project is set to remove previous versions
  • the 'Permanent' property on the .exe is set to False

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

+6  A: 

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

Mike Ohlsen
I found this in the log:File: C:\Program Files (x86)\Company\Project\Project.exe; Won't Overwrite; Won't patch; Existing file is of an equal versionWhat do I have to do to get it to see that the file has changed??
Stuart Dunkeld
looking at the file now. edit the original question and put the log link there so other can more easily find it.
Mike Ohlsen
Thanks for your help, I think I've got it working now.I did notice that the question you refer to states:"The Upgrade Code should never change"
Stuart Dunkeld
A: 

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.

leppie
No, the app isn't running.
Stuart Dunkeld
A: 

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.

Aaron Daniels
+3  A: 

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."

Inverse
I have a MFC project? This is C#
Stuart Dunkeld
A: 

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.

RJ
A: 

Thank you RJ. This saved me my sanity.

Chris