0

I have a Visual Studio Setup Project that includes a number of icons with the installation. The issue I am running into regards these icons being deleted.

If I delete one of these icons through the file system, the MSI repair tool kicks in and prevents me from deleting this icon. (BAD)

I need to be able to install these icons as a default set of icons, but be able to delete them permanently after installation without the MSI repair tool kicking in.

What do I need to do in order to have a set of files that will be installed, but can be deleted later without interference.( Non - essential files )

Sara Liu - MSFT
  • 6,007
  • 1
  • 21
  • 27
Marty
  • 5
  • 2
  • If anyone needs more clarification, i'm standing by and will answer to the best of my ability. – Marty Apr 26 '17 at 16:00

3 Answers3

0

It's not an easy problem to solve using that tool. The problem is this tool authors every shortcut as advertised and every file is a keyfile of it's own component. It really sets you up for these sorts of undesired resilency invocations.

There are ways of hacking the MSI in a postbuild step to turn off advertisement and other attributes but honestly my best recommendation is to switch to a toolset such as Windows Installer XML or InstallShield Limited Edition. You could use WiX to author your merge module and consume it like here:

http://blog.iswix.com/2011/03/redemption-of-visual-studio-deployment.html

I spent an entire year of my life (2006-2007) fighting this tool and I wish I could get it back.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
0

FWIW, I believe your design goal of desiring to delete the files without MSI ever repairing them is misguided. Windows Installer is a declarative installation framework and it "owns" the desired state of the application installation and will always work to maintain it. There is really no practical way around this.

What you can do is design your application so that "stock" icons are in one folder and your application copies them to another folder on first run and uses them from there. MSI never knows about this other folder so if you service the files (add/edit/delete) MSI won't interfere. However you can never delete the stock icons because MSI will fix it for you.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
0

The supported way of doing this is documented here in the Component table:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa368007(v=vs.85).aspx

under ComponentId where it says that it can be set to null so that the component isn't removed or repaired by Windows. This isn't supported by Visual Studio, so you'd need to edit your MSI after it's built using (for example) Orca from the Windows SDK. Set the ComponentId to null for the files you don't want repaired, and if it's not obvious then look at the File table for the file names and associated Component names that will refer to the Component table.

You'll need to remove the files manually or with a custom action at uninstall time.

PhilDW
  • 20,260
  • 1
  • 18
  • 28