开发者

In what order are projects returned using ActiveSolutionProjects?

开发者 https://www.devze.com 2023-01-17 04:49 出处:网络
Im using this code, inside a project template wizard. DTE dte = project.DTE; VSProject vsProj = (VSProject)project.Object;

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 开发者_Go百科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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消