IVsAppCompat 介面
IVsAppCompat 介面通常用來中斷與舊版的應用程式專案的相容性。 這個介面是可透過 SVsSolution 服務。
如需詳細資訊,請參閱 進行自訂專案版本感知。
命名空間: Microsoft.VisualStudio.Shell.Interop
組件: Microsoft.VisualStudio.Shell.Interop.11.0 (於 Microsoft.VisualStudio.Shell.Interop.11.0.dll)
語法
[GuidAttribute("0F9810E7-36BA-4986-938B-F7E14EE02F9A")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
public interface IVsAppCompat
[GuidAttribute("0F9810E7-36BA-4986-938B-F7E14EE02F9A")]
[InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIUnknown)]
public interface class IVsAppCompat
[<GuidAttribute("0F9810E7-36BA-4986-938B-F7E14EE02F9A")>]
[<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)>]
type IVsAppCompat = interface end
<GuidAttribute("0F9810E7-36BA-4986-938B-F7E14EE02F9A")>
<InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)>
Public Interface IVsAppCompat
方法
名稱 | 描述 | |
---|---|---|
![]() |
AskForUserConsentToBreakAssetCompat(Array) | 顯示對話方塊,詢問使用者同意,若要中斷的專案相容性清單中。 如果使用者不會不同意繼續進行,這個方法會擲回 COMException 與 ErrorCode OLE_E_PROMPTSAVECANCELLED。 |
![]() |
BreakAssetCompatibility(IVsHierarchy, String) | |
![]() |
GetCurrentDesignTimeCompatVersion(String) | 取得這個版本的 Visual Studio 目前的設計階段相容性版本。 |
註解
當您需要中斷相容性時,應該先呼叫專案系統 AskForUserConsentToBreakAssetCompat 之前,先呼叫 M:Microsoft.VisualStudio.Shell.Interop.IVsAppCompat.BreakAssetCompatibility(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy)。
下列呼叫順序是典型的︰
呼叫 AskForUserConsentToBreakAssetCompat 方法,以顯示對話方塊,詢問使用者是否同意。 如果使用者不會不同意繼續進行,這個方法會擲回 COMException 與 ErrorCode OLE_E_PROMPTSAVECANCELLED。
如果 COMException 不擲回,請中斷相容性的變更。
若要完成相容性中斷,呼叫 M:Microsoft.VisualStudio.Shell.Interop.IVsAppCompat.BreakAssetCompatibility(Microsoft.VisualStudio.Shell.Interop.IVsHierarchy) 方法。
BreakAssetCompatibility 方法呼叫 GetCurrentDesignTimeCompatVersion 方法,以取得字串,代表目前版本的 Visual Studio。
BreakAssetCompatibility 然後方法會呼叫 SetProperty 方法,將專案 VSHPROPID_MinimumDesignTimeCompatVersion 屬性設定為上一個步驟中取得的版本字串的值。
另請參閱
Microsoft.VisualStudio.Shell.Interop 命名空間
回到頁首