public static void RefreshProject(Project project)
    {
        try
        {
            project.Save();
        }
        catch (Exception)
        {
        }

        IVsHierarchy projectHierarchy = HierarchyManager.GetEquivalent(project);

        if (projectHierarchy != null)
        {
            Guid projectGuid = HierarchyManager.GetProjectGuid(projectHierarchy);
            HierarchyManager.EnsureProjectIsLoaded(projectGuid);
            HierarchyManager.UnloadProject(projectGuid);
            HierarchyManager.ReloadHierarchy(projectGuid);
            HierarchyManager.EnsureProjectIsLoaded(projectGuid);
        }
    }