共用方式為


IVsAppCompat Interface

Definition

The IVsAppCompat interface is typically used to break compatibility of projects with previous versions of the application. This interface is available via the SVsSolution service.For more information, see Making Custom Projects Version-Aware.

public interface class IVsAppCompat
public interface class IVsAppCompat
__interface IVsAppCompat
[System.Runtime.InteropServices.Guid("0F9810E7-36BA-4986-938B-F7E14EE02F9A")]
[System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsAppCompat
[<System.Runtime.InteropServices.Guid("0F9810E7-36BA-4986-938B-F7E14EE02F9A")>]
[<System.Runtime.InteropServices.InterfaceType(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)>]
type IVsAppCompat = interface
Public Interface IVsAppCompat
Attributes

Remarks

When you need to break compatibility, the project system should first call AskForUserConsentToBreakAssetCompat before calling BreakAssetCompatibility.

The following call sequence is typical:

  1. Call the AskForUserConsentToBreakAssetCompat method to show a dialog box that asks for user consent. If the user does not agree to continue, this method throws a COMException with an ErrorCode of OLE_E_PROMPTSAVECANCELLED.

  2. If a COMException is not thrown, make the changes that break the compatibility.

  3. To finalize the compatibility break, call the BreakAssetCompatibility method.

  4. The BreakAssetCompatibility method calls the GetCurrentDesignTimeCompatVersion method to obtain a string that represents the current version of Visual Studio.

  5. The BreakAssetCompatibility method then calls the SetProperty method to set the project VSHPROPID_MinimumDesignTimeCompatVersion property to the value of the version string that was obtained in the previous step.

Methods

AskForUserConsentToBreakAssetCompat(Array)

Shows a dialog box that asks for user consent to break the compatibility of projects in a list. If the user does not agree to continue, this method throws a COMException with an ErrorCode of OLE_E_PROMPTSAVECANCELLED.

BreakAssetCompatibility(IVsHierarchy, String)
GetCurrentDesignTimeCompatVersion(String)

Gets the current design time-compatibility version for this version of Visual Studio.

Applies to