共用方式為


VSProject2.Refresh 方法

重新整理 [方案總管] 中的專案外觀,並且重新整理參考。

命名空間:  VSLangProj80
組件:  VSLangProj80 (在 VSLangProj80.dll 中)

語法

'宣告
Sub Refresh
void Refresh()
void Refresh()
abstract Refresh : unit -> unit 
function Refresh()

實作

VSProject.Refresh()

備註

此方法會更新專案外觀,包括檔案和資料夾,而且會重新整理所有參考。

範例

此範例會重新整理專案的外觀。 若要將此範例當做增益集來執行,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例。 開啟 Visual Basic 或 Visual C# 專案,再執行此範例。

[Visual Basic]

' Add-in code.
Imports VSLangProj
Imports VSLangProj80
Public Sub OnConnection(ByVal application As Object,_
 ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
 ByRef custom As Array) Implements IDTExtensibility2.OnConnection
    applicationObject = CType(application, DTE2)
    addInInstance = CType(addInInst, AddIn)
    RefreshExample(applicationObject)
End Sub
Sub RefreshExample(ByVal dte As DTE2)
    ' This example assumes that the first project in the solution is 
    ' a Visual Basic or C# project.
    Dim aVSProject As VSProject2 = _
    CType(applicationObject.Solution.Projects.Item(1).Object, _
    VSProject2)
    aVSProject.Refresh()
End Sub

[C#]

using VSLangProj;
using VSLangProj2;
using VSLangProj80;
public void OnConnection(object application,
 ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
    applicationObject = (DTE2)application;
    addInInstance = (AddIn)addInInst;
    RefreshExample((DTE2)applicationObject);
}

public void RefreshExample(DTE2 dte)
{
    // This example assumes that the first project in the solution is 
    // a Visual Basic or C# project.
    VSProject2 aVSProject = 
((VSProject2)( applicationObject.Solution.Projects.Item(1).Object));
    aVSProject.Refresh();
}

.NET Framework 安全性

請參閱

參考

VSProject2 介面

Refresh 多載

VSLangProj80 命名空間