0

Im using this code, inside a project template wizard.

DTE dte = project.DTE;
VSProject vsProj = (VSProject)project.Object;

Array projects = (Array)dte.ActiveSolutionProjects;
Project activeProject = (Project)projects.GetValue(0);

But im curious in what order the projects are returned? The code above is running just after the project is created, in the

public void ProjectFinishedGenerating(Project project)

In what order does the projects get returned? My goal is to get the newest project, will GetValue(0) do that?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Moulde
  • 3,438
  • 4
  • 29
  • 38

1 Answers1

1

I looked at this a while back and the order seems to be non-determinstic.

GetValue(0) is the active project which might not be newest project.

To find the newested, you will need to traverse the projects using either the file stamp on the project file (if saved) plus ranking non-saved ones higher as higher.

Stephen Gennard
  • 1,910
  • 16
  • 21