共用方式為


IVsProjectUpgrade Interface

Definition

Implemented by project objects that need to upgrade project file formats between different versions of Visual Studio.

public interface class IVsProjectUpgrade
public interface class IVsProjectUpgrade
__interface IVsProjectUpgrade
[System.Runtime.InteropServices.Guid("75661D39-F5DA-41B9-ABDA-9CF54C6B1AC9")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IVsProjectUpgrade
[System.Runtime.InteropServices.Guid("75661D39-F5DA-41B9-ABDA-9CF54C6B1AC9")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsProjectUpgrade
[<System.Runtime.InteropServices.Guid("75661D39-F5DA-41B9-ABDA-9CF54C6B1AC9")>]
[<System.Runtime.InteropServices.InterfaceType(1)>]
type IVsProjectUpgrade = interface
[<System.Runtime.InteropServices.Guid("75661D39-F5DA-41B9-ABDA-9CF54C6B1AC9")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsProjectUpgrade = interface
Public Interface IVsProjectUpgrade
Attributes

Remarks

When a user attempts to open a project, UpgradeProject is called by the environment after the project is opened and before any other user action can be taken on the project. If the user had already been prompted to upgrade the solution, then the UPF_SILENTMIGRATE flag is passed in the grfUpgradeFlags parameter. If the user opens a project directly, as in Add Existing Project, then the UPF_SILENTMIGRATE flag is not passed and the project needs to prompt the user to upgrade.

In response to the UpgradeProject call, the project should evaluate whether the project file will be upgraded. If the project does not need to upgrade the project type to a new version, then it can simply return S_OK.

If the project needs to upgrade the project type to a new version, then it must determine whether the project file can be modified by calling QueryEditFiles and passing in a value of QEF_ReportOnly for the rgfQueryEdit parameter. The project then needs to do the following:

Note

In the instance that your first project (Project1) is placed in the inactive state, then you must return S_OK from the first call to your UpgradeProject implementation.

For an example implementation of this interface, see Basic Project.

Notes to Implementers

Implement if you have changed the information persisted in the project file between older and current Visual Studio versions of your product. The environment retrieves this interface by calling QueryInterface from IVsHierarchy.

Methods

UpgradeProject(UInt32)

Called by the environment to determine whether the project object needs to upgrade the project to a new version.

Applies to