VSProject2.Refresh Method

Refreshes the appearance of the project in Solution Explorer and refreshes the references.

Namespace:  VSLangProj80
Assembly:  VSLangProj80 (in VSLangProj80.dll)

Syntax

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

Remarks

This method updates the appearance of the project, including the files and folders, as well as refreshing all references.

Examples

This example refreshes the appearance of the project. To run this example as an add-in, see How to: Compile and Run the Automation Object Model Code Examples. Open a Visual Basic or Visual C# project before running this example.

[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 Security

See Also

Reference

VSProject2 Interface

VSLangProj80 Namespace