Dynamic creation of VS Project
I have a project where I create WiX (Windows Installer for X开发者_运维技巧ML) files, when they are not already present. It is working perfectly. Now I want to expand it to add more functionality. I was wondering if there is a way to create a Visual Studio project programmatically? This project is run as part of our nightly build process, and when a new wix file is needed it is created, but I want to have everything in place when the build is finished so if necessary you can just open the project in Visual Studio and start editing. Am I dreaming outside the realm of possibility or no? Any nudge in the right direction will be greatly appreciated.
Project files are xml, so there is no reason why you couldn't (the hard way)
There are Visual Studio APIs available for creating projects How to: Programatically Create Projects
In general, I don't believe this is a good idea. While I'm in favor of full end to end build automation, the installer is source and any changes to it should be done intentionally. I don't like the face that files blip in and blip out of the install. If a product adds a file, it should be explicitly added to the installer and if a file is removed it should be explicitly removed from the installer. Any change to this baseline without a corrosponding change should raise a build break.
This is, IMO, the only way to be 100% certain that what goes into an install is intentional and accurate.
精彩评论