private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action) { ThreadHelper.ThrowIfNotOnUIThread("BuildEvents_OnBuildDone"); logger.Info("BuildEvents_OnBuildDone called"); dte.Events.BuildEvents.OnBuildDone -= BuildEvents_OnBuildDone; if (dte.Solution.SolutionBuild.LastBuildInfo == 1) { VsShellUtilities.ShowMessageBox(package, "Please fix build error and retry", "Error", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); logger.Error("BuildEvents_OnBuildDone build failed"); return; } dte.Debugger.Breakpoints.Add(fun.FullName, "", selectedLine.TopLine); CodeFunction codeFunction = null; SchemaInfo schemaInfo = new SchemaInfo(); schemaInfo.MethodToRun = fun.Name; schemaInfo.MethodType = (int)fun.Access; schemaInfo.MethodParameters = fun.Parameters.OfType <CodeParameter2>().ToList().ConvertAll((CodeParameter2 x) => x.Type.AsFullName); string text = clas.Namespace.Name + "."; schemaInfo.NameSpaceAndClass = text + clas.FullName.Replace(text, "").Replace('.', '+'); schemaInfo.AssambleName = dte.ActiveDocument.ProjectItem.ContainingProject.Name; string tempPath = Path.GetTempPath() + ".LuckyHome\\" + Path.GetFileNameWithoutExtension(project.FullName); string methodBasedUniqueName = schemaInfo.GetMethodBasedUniqueName(); schemaInfo.FullMethodBasedUniqueName = tempPath + methodBasedUniqueName; if (!Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } //var tempProjects = dte.Solution.Projects.Cast<Project>(); projects = ClassFinder.FindProjects(dte.Solution); List <string> list = new List <string>(); foreach (string item in dte.Solution.SolutionBuild.StartupProjects as Array) { // sorry, you'll have to OfType<Project>() on Projects (dte is my wrapper) // find my Project from the build context based on its name. Vomit. var project = projects.First(x => x.UniqueName.EndsWith(item)); // Combine the project's path (FullName == path???) with the // OutputPath of the active configuration of that project var tempProperties = project.ConfigurationManager.ActiveConfiguration.Properties; var dir = Path.Combine( Path.GetDirectoryName(project.FullName), tempProperties.Item("OutputPath").Value.ToString(), project.Properties.Item("OutputFilename").Value.ToString() ); // and combine it with the OutputFilename to get the assembly // or skip this and grab all files in the output directory list.Add(dir); } schemaInfo.StartAppProject = list.ToArray(); codeFunction = getConstructor(clas); List <ClassInfo> depandancyClasses = new List <ClassInfo>(); List <InputValue> inputValues = new List <InputValue>(); if (codeFunction != null) { getParamType(codeFunction, depandancyClasses, inputValues); } getInterfaceMapper(schemaInfo, depandancyClasses, inputValues); logger.Info("BuildEvents_OnBuildDone ended"); }