public void OnBuildProjConfigBegin(string projName, string projConfig , string platform, string solConfig) { if (solConfig.Contains(" [ChartPoints]")) { extensionServ.SetMode(EMode.Build); ServiceHost serviceHost = null; try { EnvDTE.Project proj = Globals.dte.Solution.Projects.Item(projName); //!!! Needed for newly created project to update vcxproj file !!! //Orchestrate(proj.FullName); IProjectChartPoints pPnts = Globals.processor.GetProjectChartPoints(proj.Name); if (pPnts != null) { VCProject vcProj = (VCProject)proj.Object; VCConfiguration vcConfig = vcProj.Configurations.Item(projConfig); IVCCollection tools = vcConfig.Tools as IVCCollection; VCLinkerTool tool = tools.Item("VCLinkerTool") as VCLinkerTool; tool.GenerateDebugInformation = false; pPnts.Validate(); if (!serviceHostsCont.TryGetValue(proj.FullName, out serviceHost)) { serviceHostsCont.Add(proj.FullName, serviceHost); } if (serviceHost == null) { serviceHost = new ServiceHost(typeof(IPCChartPoint)); serviceHostsCont[proj.FullName] = serviceHost; //if (serviceHost.State != CommunicationState.Opening && serviceHost.State != CommunicationState.Opened) //{ NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); string address = "net.pipe://localhost/IPCChartPoint/" + System.IO.Path.GetFullPath(proj.FullName).ToLower(); serviceHost.AddServiceEndpoint(typeof(IIPCChartPoint), binding, address); serviceHost.Open(); //} } } } catch (Exception /*ex*/) { serviceHost = null; } } }
public bool AddProjectChartPoints(string projName, out IProjectChartPoints pPnts) { pPnts = GetProjectChartPoints(projName); if (pPnts == null) { pPnts = CP.Utils.IClassFactory.GetInstance().CreateProjectCPs(projName); if (!pPnts.Validate()) { pPnts = null; return(false); } AddProjectChartPoints(pPnts); return(true); } return(false); }