4

For normal source code projects, when you ask Visual Studio to build the project it will only build it if it is considered out of date. (The documentation for the /build command line switch confirms this.)

However, for setup projects it seems that Visual Studio always builds them, regardless of whether or not the dependencies are up to date. This happens even for a simple scenario where the setup project contains only the primary output of another project.

Why do setup projects behave this way? Is there a way to change this behavior?

Holistic Developer
  • 2,458
  • 1
  • 18
  • 27
  • 1
    Yet another reason to not use setup projects. FWIW, Microsoft has killed them and they won't be in VS2012. InstallShield Limited Edition is the suggested replacement unless you need more. WiX is another option. – Christopher Painter Jan 25 '12 at 02:34
  • @ChristopherPainter, that's a good reminder on the shelf life of VS setup projects. Do you know if InstallShield LE project behave differently? – Holistic Developer Jan 25 '12 at 08:10
  • Honestly, I don't know. I typically keep the installer in a seperate solution anyways. If it was in the solution, it usually stands to reason that since the installer packages everything up that if something changed, anything, that the installer probably needs to be built. Most developers don't want to deal with that thus my reason for putting it into a seperate SLN. – Christopher Painter Jan 25 '12 at 11:12
  • I did download InstallShield LE for VS 2010 and it actually does skip building the setup when everything is up to date. – Holistic Developer Jan 26 '12 at 01:18

1 Answers1

2

The setup project is actually a packaging utility, it will check all of the projects and build them if necessary, but it will create a new package each time that you run it. There is no way to change this behavior that I can see.

I usually set my Build - Configuration Manager to not build the Setup Projects. I then run the build on them when I am wanting to create/update a setup.

Mark Hall
  • 53,938
  • 9
  • 94
  • 111
  • Thanks for the confirmation. In our particular case, we have a NAnt script that we use for our daily builds that builds the setup project. We also use the NAnt script on our dev machines to run full system builds, and it can be nice to make them fully "incremental" in case you need to run it multiple times on your machine before checking in. I changed our NAnt script to see if the .MSI is up-to-date compared to the main executable included in it. That lets us avoid rebuilding the .MSI when running the script multiple times. – Holistic Developer Jan 25 '12 at 08:15
  • 1
    I would think you could make a solution configuration that excludes the installer for those situations. For example build the installer in release but not debug. – Christopher Painter Jan 26 '12 at 01:49