How do I stop SQL Server 2008 R2 trying to install some package when I build my setup project?

When you build a Microsoft Visual Studio 2010 setup project a Microsoft SQL Server 2008 R2 setup might start. To solve this problem on a x64 system:

regsvr32.exe /u "C:\Program Files (x86)\Common Files\microsoft shared\MSI Tools\mergemod.dll"
regsvr32.exe "C:\Program Files (x86)\Common Files\microsoft shared\MSI Tools\mergemod.dll"

on a x86 system

regsvr32.exe /u "C:\Program Files\Common Files\microsoft shared\MSI Tools\mergemod.dll"
regsvr32.exe "C:\Program Files\Common Files\microsoft shared\MSI Tools\mergemod.dll"

The folder c:\687b0370badbfcf47c is what was created by the SQL install when you ran it - it creates a randomly named folder and then expands all its setup files into that folder. Whichever feature you are missing was merely installed as "advertised" instead of being installed fully, this means it doesn't get installed until you actually try to use the feature, which is what the publish functionality of VS is doing.

I can't guess exactly what is missing, but this is how to fix it.

  • uninstall your current instance of SQL (which will take 10 to 15 mins depending on the speed of your machine), then reinstall. Make sure you take the install option that allows you to choose which feature to install, then make sure you have selected the database engine, client connectivity tools, management tools (if available), and also Management Studio (if available - you might as well, managing the database without it is a PITA).

  • or you can start to install another instance from the same SQL installer package. Once you get to the initial setup screen, bring up file explorer and find the temp folder it has made and its expanded install files. Recreate the folder c:\687b0370badbfcf47c, and copy the expanded install files over to it. Then cancel the install you had in progress. Now build your setup again, the SQL install will kick in, but now it should complete and let you continue.