How to: Upgrade Project Items
Visual Studio SDK partners that add or manage items inside project systems they do not implement may need to participate in the project upgrade process. In Visual Studio 2008, Crystal Reports is an example of an item that can be added to the project system.
Typically, project item implementers want to leverage an already fully instantiated and upgraded project because they need to know what the project references are and what other project properties are there to make an upgrade decision.
To get the project upgrade notification
Set the SolutionOrProjectUpgrading flag (defined in vsshell80.idl) in your project item implementation. This causes your project item VSPackage to auto load when the Visual Studio shell determines that a project system is in the process of upgrading.
The IVsSolutionEventsProjectUpgrade interface is fired after the project system implementation has completed its upgrade operations and the new upgraded project is created. Depending on the scenario, the IVsSolutionEventsProjectUpgrade interface is fired after the OnAfterOpenSolution, the OnAfterOpenProject, or the OnAfterLoadProject methods.
To upgrade the project item files
You must carefully manage the file backup process in your project item implementation. This applies in particular for a side-by-side backup, where the fUpgradeFlag parameter of the UpgradeProject method is set to PUVFF_SXSBACKUP, where files that had been backed up are placed along side files that are designated as ".old". The backed up files older than the system time when the project was upgraded can be designated as stale. Furthermore, they might be overwritten unless you take specific steps to prevent this.
At the time your project item gets a notification of the project upgrade, the Visual Studio Conversion Wizard is still displayed. Therefore, you should use the methods of the IVsUpgradeLogger interface to provide upgrade messages to the wizard UI.