VSProject2.Refresh 方法

刷新**“解决方案资源管理器”**中项目的外观,并刷新引用。

命名空间:  VSLangProj80
程序集:  VSLangProj80(在 VSLangProj80.dll 中)

语法

声明
Sub Refresh
void Refresh()
void Refresh()
abstract Refresh : unit -> unit 
function Refresh()

备注

此方法对项目的外观(包括文件和文件夹)进行更新并刷新所有引用。

示例

此示例刷新项目的外观。 若要将此示例作为外接程序运行,请参见如何:编译和运行自动化对象模型代码示例。 在运行此示例之前,请打开一个 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 命名空间