Permalink
Browse files

Fix of start by Ctrl+F5

  • Loading branch information...
1 parent 766198e commit 1e19b77e98ac5036a4edf810c684668ca71a2f2e @VladD2 VladD2 committed Aug 30, 2012
@@ -440,13 +440,46 @@ static bool StartNoDebug(EnvDTE.DTE dte)
return true;
}
+ private static EnvDTE.Project FindProject(EnvDTE.ProjectItem project, string projectFullName)
+ {
+ EnvDTE.Project subProject = project.Object as EnvDTE.Project;
+
+ if (subProject == null)
+ return null;
+
+ if (!string.IsNullOrWhiteSpace(subProject.FullName) && Utils.Eq(Path.GetFullPath(subProject.FullName), projectFullName))
+ return subProject;
+
+
+ if (subProject.ProjectItems == null)
+ return null;
+
+ foreach (EnvDTE.ProjectItem project2 in subProject.ProjectItems)
+ {
+ Debug.WriteLine(project2.Name);
+ var res = FindProject(project2, projectFullName);
+ if (res != null)
+ return res;
+ }
+
+ return null;
+ }
+
private static EnvDTE.Project GetProject(EnvDTE.DTE dte, string startupProjectFullName)
{
// FIXME! Следующая строка перестала раблотать в VS 2010!
+ //var nemerleOAProject = dte.Solution.FindProjectItem(startupProjectFullName);
//nemerleOAProject = dte.Solution.FindProjectItem(startupProjectFullName) as NemerleOAProject;
- foreach (EnvDTE.Project project in dte.Solution.Projects)
- if (Utils.Eq(Path.GetFullPath(project.FullName), startupProjectFullName))
- return project;
+ foreach (EnvDTE.Project project in dte.Solution.Projects)
+ {
+ foreach (var project2 in project.ProjectItems)
+ {
+ EnvDTE.ProjectItem project3 = project2 as EnvDTE.ProjectItem;
+ var res = FindProject(project3, startupProjectFullName);
+ if (res != null)
+ return res;
+ }
+ }
return null;
}
@@ -4990,8 +4990,9 @@ public virtual int IsDocumentInProject(string mkDoc, out int found, VSDOCUMENTPR
found = 0;
itemId = 0;
+ var mkDocument = this.GetMkDocument();
// If it is the project file just return.
- if (NativeMethods.IsSamePath(mkDoc, this.GetMkDocument()))
+ if (NativeMethods.IsSamePath(mkDoc, mkDocument))
{
found = 1;
itemId = VSConstants.VSITEMID_ROOT;

0 comments on commit 1e19b77

Please sign in to comment.