Get the newest uninstaller for the updated ProductCode in VS 2010

When we are using the VS 2010 and trying to release our application to the customer, we sometimes use the default deployment project to create a simple msi package as the solution. But if any update is released, it is very important to change the Version/ProductCode of our vdproj project, and we need to modify the uninstaller’s ProductCode. If more projects, we need modify more uninstallers. Is there any solution or workaround to avoid the bothering work? Of course, there is.

1. You should get the following code to create a project named “ProductCodeFixer”:

 

2. Add the ProductCodeFixer to uninstaller’s directory, and set an vdproj file path as a parameter, the ProductCodeFixer will automaticly change the uninstaller’s version.

Note: You can get the uninstaller from here.

3. Before creating the msi package, we should add PreBuildEvent to our project like the following: “$(ProjectDir)\xxxx\ProductCodeFixer.exe” “$(ProjectDir)\xxxx\our_proj.vdproj” . After running PreBuildEvent, you’ll get a new uninstaller for the new msi package.