private void OnBuildBegin(vsBuildScope Scope, vsBuildAction Action) { if (!IsCESharpSolution) { return; } if (Action != vsBuildAction.vsBuildActionClean) { OutputPane.Log($"Building ({Scope})."); } }
private void OnSolutionOpened() { CryEngineRoot = null; foreach (Project project in DTE.Solution.Projects) { var ceRoot = GetUserProperty(project, "CryEngineRoot"); if (ceRoot != null) { CryEngineRoot = ceRoot; } } if (IsCESharpSolution) { OutputPane.Init(DTE); OutputPane.Clear(); OutputPane.Log($"CE# Solution detected. CryEngine Root: \"{CryEngineRoot}\""); // Setup default values for CE# projects if not yet initialized. bool reOpenProject = false; foreach (Project p in DTE.Solution.Projects) { var ceRoot = GetUserProperty(p, "CryEngineRoot"); if (ceRoot != null) { if (GetUserProperty(p, "StartAction") == null) { SetUserProperty(p, "StartAction", "Program"); reOpenProject = true; } if (GetUserProperty(p, "StartProgram") == null) { SetUserProperty(p, "StartProgram", GetUserProperty(p, "LocalDebuggerCommand")); reOpenProject = true; } if (GetUserProperty(p, "StartArguments") == null) { SetUserProperty(p, "StartArguments", GetUserProperty(p, "LocalDebuggerCommandArguments")); reOpenProject = true; } } if (reOpenProject) { string solutionName = Path.GetFileNameWithoutExtension(DTE.Solution.FullName); DTE.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Activate(); DTE.ToolWindows.SolutionExplorer.GetItem(solutionName + @"\" + p.Name).Select(vsUISelectionType.vsUISelectionTypeSelect); DTE.ExecuteCommand("Project.UnloadProject"); DTE.ExecuteCommand("Project.ReloadProject"); } } } }
private void CompilePDBs() { OutputPane.Log("Compiling PDB's."); var pdb2mdb = Path.GetFullPath($"{CryEngineRoot}\\Tools\\pdb2mdb\\pdb2mdb.exe"); if (!File.Exists(pdb2mdb)) { OutputPane.LogError($"Cannot find PDB2MDB executable ({pdb2mdb})."); return; } foreach (Project p in DTE.Solution.Projects) { string outputFileName = p.Properties.Item("AssemblyName").Value.ToString() + ".dll"; var fullPath = new FileInfo(p.Properties.Item("FullPath").Value.ToString()).Directory.ToString(); var outputPath = p.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString(); string outputDir = Path.Combine(fullPath, outputPath); // Skip if MDB is newer than PDB. var pdbFullName = Path.Combine(outputDir, outputFileName.Substring(0, outputFileName.Length - 4) + ".pdb"); var mdbFullName = Path.Combine(outputDir, outputFileName + ".mdb"); if (File.Exists(pdbFullName) && File.Exists(mdbFullName)) { if (new FileInfo(pdbFullName).LastWriteTime < new FileInfo(mdbFullName).LastWriteTime) { continue; } } OutputPane.Log($"Converting \"{outputFileName}\"."); var psi = new ProcessStartInfo(pdb2mdb, $"\"{Path.Combine(outputDir, outputFileName)}\""); System.Diagnostics.Process.Start(psi); } OutputPane.Log("Done."); }
private void OnSolutionAfterClosing() { OutputPane.Shutdown(); }