//FIXME: add a test for null @toolsVersion public bool BuildProjectFile(string projectFile, string[] targetNames, BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags, string toolsVersion) { Project project; if (projects.ContainsKey(projectFile)) { project = (Project)projects [projectFile]; } else { project = CreateNewProject(); project.Load(projectFile); } BuildPropertyGroup engine_old_grp = null; BuildPropertyGroup project_old_grp = null; if (globalProperties != null) { engine_old_grp = GlobalProperties.Clone(true); project_old_grp = project.GlobalProperties.Clone(true); // Override project's global properties with the // ones explicitlcur_y specified here foreach (BuildProperty bp in globalProperties) { project.GlobalProperties.AddProperty(bp); } project.NeedToReevaluate(); } try { if (String.IsNullOrEmpty(toolsVersion) && defaultToolsVersion != null) { // it has been explicitly set, xbuild does this.. //FIXME: should this be cleared after building? project.ToolsVersion = defaultToolsVersion; } else { project.ToolsVersion = toolsVersion; } return(project.Build(targetNames, targetOutputs, buildFlags)); } finally { if (globalProperties != null) { GlobalProperties = engine_old_grp; project.GlobalProperties = project_old_grp; } } }
public bool BuildProjectFile(string projectFile, string[] targetNames, BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags) { Project project; if (projects.ContainsKey(projectFile)) { project = (Project)projects [projectFile]; } else { project = CreateNewProject(); project.Load(projectFile); } BuildPropertyGroup engine_old_grp = null; BuildPropertyGroup project_old_grp = null; if (globalProperties != null) { engine_old_grp = GlobalProperties.Clone(true); project_old_grp = project.GlobalProperties.Clone(true); // Override project's global properties with the // ones explicitlcur_y specified here foreach (BuildProperty bp in globalProperties) { project.GlobalProperties.AddProperty(bp); } project.NeedToReevaluate(); } try { return(project.Build(targetNames, targetOutputs, buildFlags)); } finally { if (globalProperties != null) { GlobalProperties = engine_old_grp; project.GlobalProperties = project_old_grp; } } }
private void GenerateGlobalProperties() { GlobalProperties.Clone(new GlobalProperties { OurCompany = CompanyUetm, StandartPaymentsConditionSet = PaymentConditionSet50Na50, NewProductParameter = ParameterNewProduct, NewProductParameterGroup = ParameterGroupNewProductDesignation, VoltageGroup = ParameterGroupVoltage, ServiceParameter = ParameterService, SupervisionParameter = ParameterSupervision, DefaultProjectType = ProjectTypeReconstruction, SenderOfferEmployee = EmployeeDeev, RecipientSupervisionLetterEmployee = EmployeeGuseinov, HvtProducersActivityField = ActivityFieldProducerOfHvt, PaymentConditionSet = PaymentConditionSet50Na50, ComplectDesignationGroup = ParameterGroupComplectDesignationGroup, ComplectsGroup = ParameterGroupComplectsGroup, ComplectsParameter = ParameterComplects, ProductIncludedDefault = ProductZip1, IsolationMaterialGroup = ParameterGroupIsolationMaterial, IsolationColorGroup = ParameterGroupIsolationColor, IsolationDpuGroup = ParameterGroupIsolation, Developer = UserKosolapov, LastDeveloperVizit = DateTime.Today, StandartTermFromPickToEndProduction = 7, StandartTermFromStartToEndProduction = 120, ActualPriceTerm = 90, Date = DateTime.Today }); #if DEBUG GlobalProperties.IncomingRequestsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "HVTAppTest", "Requests"); GlobalProperties.DirectumAttachmentsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "HVTAppTest", "Directum"); GlobalProperties.TechnicalRequrementsFilesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "HVTAppTest", "Tce"); GlobalProperties.TechnicalRequrementsFilesAnswersPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "HVTAppTest", "TceAnswer"); GlobalProperties.PriceCalculationsFilesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "HVTAppTest", "PriceCalculations"); GlobalProperties.ShippingCostFilesPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "HVTAppTest", "ShippingCalculations"); GlobalProperties.LogsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "HVTAppTest", "Logs"); #endif }
bool BuildProjectFileInternal(string projectFile, string[] targetNames, BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags, string toolsVersion) { if ((buildFlags & BuildSettings.DoNotResetPreviouslyBuiltTargets) != BuildSettings.DoNotResetPreviouslyBuiltTargets) { builtTargetsOutputByName.Clear(); } Project project; bool newProject = false; if (!projects.TryGetValue(projectFile, out project)) { project = CreateNewProject(); newProject = true; } BuildPropertyGroup engine_old_grp = null; BuildPropertyGroup project_old_grp = null; if (globalProperties != null) { engine_old_grp = GlobalProperties.Clone(true); project_old_grp = project.GlobalProperties.Clone(true); // Override project's global properties with the // ones explicitlcur_y specified here foreach (BuildProperty bp in globalProperties) { project.GlobalProperties.AddProperty(bp); } if (!newProject) { project.NeedToReevaluate(); } } if (newProject) { project.Load(projectFile); } try { string oldProjectToolsVersion = project.ToolsVersion; if (String.IsNullOrEmpty(toolsVersion) && defaultToolsVersion != null) { // no tv specified, let the project inherit it from the // engine. 'defaultToolsVersion' will be effective only // it has been overridden. Otherwise, the project's own // tv will be used. project.ToolsVersion = defaultToolsVersion; } else { project.ToolsVersion = toolsVersion; } try { return(project.Build(targetNames, targetOutputs, buildFlags)); } finally { project.ToolsVersion = oldProjectToolsVersion; } } finally { if (globalProperties != null) { GlobalProperties = engine_old_grp; project.GlobalProperties = project_old_grp; } } }