问题
I've followed the steps described here to modify the ProductCode and ProductVersion on my setup project on each build, using a prebuild event.
(meaning- I created a console application that uses the above-mentioned code to modify the .vdproj file, and I trigger it from the pre-build event).
The operation is successful, and after the build is done I can see that the 'Version' property of the setup project has changed.
However, the 'ProductVersion' property of the compiled msi does not change.
Only if I build the setup project again, I can see that the 'ProductVersion' has changed.
Is it possible that the prebuild event occurs after the msi is compiled?
回答1:
I seem to recall having problems with the prebuild action on VDPROJ back around 2005 and we had to create fake C++ projects with build dependencies so we could use the postbuild of the C++ to do things before the VDPROJ build.
For the record, anything is possible (to fail) with VDPROJ. The tool is deprecated in the next release of Visual Studio because of it's shortcomings.
A postbuild SQL update of the Property table in the built MSI might be a better option. Switching to a different tool would certainly be a better option.
来源:https://stackoverflow.com/questions/9395279/pre-build-event-to-change-setup-projects-productversion-doesnt-take-effect-unt