1

I've been googling this all afternoon and I found any number of people ask the question, and all of the place a few people would answer it with the same things, and then there's a dozen comments by the rest of the world and the OP about how those answer don't fix it. So I'm going to include what I've tried here, and if your solution is to do one of the things I've already tried, I'm going to be very sad.

I have a solution in Visual Studio 2019 that has a class library, a wpf application, and a setup project (using the setup project extension). The WPF app also references a bunch of assemblies of course, but one of those is from another project I maintain in a different solution. I copy/paste the compiled dll after I update it from its own project to this one. Nothing tricky, everything works.

The problem is the installer. If I build everything and then build the installer, it produces an MSI as expected. If I right click on the project in Visual Studio and choose "Install", everything is perfect.

The problem is after I make some updates to either of the code projects, I then build both and build the setup project, and again if I right click to install it's perfect. If I run the MSI though, it doesn't always update the target files. If I delete the target files it will create them with the new ones, but it won't overwrite the old ones correctly.

  1. AssemblyVersion and AssemblyFileVersion are both being incremented each time and are being kept in sync with the "Version" property of the setup project. I tested with these extensively, the new installer that isn't working properly 100% has updated dlls in it with correctly updated version numbers.
  2. When I change the "version" of the setup, it asks to change the GUID for the ProductCode. I say yes, it changes the code. I have also tested without doing this and that makes it much worse as we all know.
  3. "RemovePreviousVersions" is set to "true" in the installer project

If I right click the project and choose "Install" it seems to be 100% reliable at upgrading the existing installation.

If I run the MSI directly it seems to be 100% unreliable and never gets it right.

Side note, it does seem to usually but not always get the WPF application upgraded and the other project dll I bring in if I remember to update its version, but the class library (which is referenced by the WPF application) almost never works.

Has anyone got this to work reliably?

Jeff Whitty
  • 116
  • 7
  • 1
    [The Horrible Facts on Visual Studio Setup Projects](https://blog.lextudio.com/the-horrible-facts-on-visual-studio-setup-projects-45e66fe86d8d) – Pavel Anikhouski Sep 04 '20 at 09:45
  • @PavelAnikhouski - linking me to a blog post that says "gee that installer project thing seems crappy" doesn't seem to be helpful in any way... – Jeff Whitty Sep 04 '20 at 10:43
  • The point here is that VS installer projects are dead already, to build an MSI package makes sense yo use WiX – Pavel Anikhouski Sep 04 '20 at 10:46
  • I guess the first thing to verify is that you are running the right MSI with regards to the Debug and Release versions? Two different builds ending up in different folders. Just check the date and time for the newly built file to verify if it is the right one. With regards to the project type, they do have a number of problems you should be aware of: [1: short list](https://stackoverflow.com/a/2637666/129130), [2: longer description](https://stackoverflow.com/a/47944893/129130). – Stein Åsmul Sep 05 '20 at 13:22
  • @PavelAnikhouski - thanks, but that's not what I asked. – Jeff Whitty Sep 07 '20 at 02:56
  • @SteinÅsmul - Yes, I have been testing this heavily and definitely have the problem accurately described, no crossed wires on builds. – Jeff Whitty Sep 07 '20 at 02:56

1 Answers1

1

For all the people finding this in the future, here's the final word:

The build project can be inconsistent, this is well documented all over the internet as I have above. You're not doing anything wrong - it is just inconsistent.

Stop trying to solve it if it's affecting your project and move on (I've had a dozen projects before this one work just fine). The consensus seems to be to use WiX, but I'm not here to discuss the alternatives. Personally I am going to embark on the WiX learning curve though.

Jeff Whitty
  • 116
  • 7