internal ProjectPropertyGroupTaskPropertyInstance (ProjectPropertyElement xml)
		{
			Condition = xml.Condition;
			Name = xml.Name;
			Value = xml.Value;
			ConditionLocation = xml.ConditionLocation;
			Location = xml.Location;
		}
		List<ProjectPropertyElement> FindSharpDevelopProjectProperties(ProjectPropertyElement msbuildProjectProperty)
		{
			lock (sharpDevelopProject.SyncRoot) {
				return sharpDevelopProject
					.MSBuildProjectFile
					.Properties
					.Where(property => String.Equals(property.Name, msbuildProjectProperty.Name, StringComparison.OrdinalIgnoreCase))
					.ToList();
			}
		}
Exemple #3
0
        /// <summary>
        /// Adds a new property group for a new configuration or platform.
        /// </summary>
        /// <param name="config">Configuration name of the full configuration being added.</param>
        /// <param name="platform">Platform name of the full configuration being added.</param>
        /// <param name="cloneCondition">Condition of property group to clone, if it exists.</param>
        private void AddNewConfigPropertyGroup(string config, string platform, string cloneCondition)
        {
            MSBuildConstruction.ProjectPropertyGroupElement newPropertyGroup = null;

            if (!String.IsNullOrEmpty(cloneCondition))
            {
                foreach (MSBuildConstruction.ProjectPropertyGroupElement propertyGroup in this.ProjectMgr.BuildProject.Xml.PropertyGroups)
                {
                    if (String.Equals(propertyGroup.Condition.Trim(), cloneCondition.Trim(), StringComparison.OrdinalIgnoreCase))
                    {
                        newPropertyGroup = this.ProjectMgr.ClonePropertyGroup(propertyGroup);
                        foreach (MSBuildConstruction.ProjectPropertyElement property in newPropertyGroup.Properties)
                        {
                            if (property.Name.Equals(WixProjectFileConstants.OutputPath) ||
                                property.Name.Equals(WixProjectFileConstants.IntermediateOutputPath))
                            {
                                property.Parent.RemoveChild(property);
                            }
                        }
                        break;
                    }
                }
            }

            if (newPropertyGroup == null)
            {
                newPropertyGroup = this.ProjectMgr.BuildProject.Xml.AddPropertyGroup();
                IList <KeyValuePair <KeyValuePair <string, string>, string> > propVals = this.NewConfigProperties;
                foreach (KeyValuePair <KeyValuePair <string, string>, string> data in propVals)
                {
                    KeyValuePair <string, string> propData = data.Key;
                    string value = data.Value;
                    MSBuildConstruction.ProjectPropertyElement newProperty = newPropertyGroup.AddProperty(propData.Key, value);
                    if (!String.IsNullOrEmpty(propData.Value))
                    {
                        newProperty.Condition = propData.Value;
                    }
                }
            }

            string outputBasePath = this.ProjectMgr.OutputBaseRelativePath;
            string outputPath     = Path.Combine(outputBasePath, WixConfigProvider.ConfigPath);

            newPropertyGroup.AddProperty(WixProjectFileConstants.OutputPath, outputPath);

            string intermediateBasePath = WixConfigProvider.IntermediateBaseRelativePath;
            string intermediatePath     = Path.Combine(intermediateBasePath, WixConfigProvider.ConfigPath);

            newPropertyGroup.AddProperty(WixProjectFileConstants.IntermediateOutputPath, intermediatePath);

            string newCondition = String.Format(CultureInfo.InvariantCulture, WixProjectConfig.ConfigAndPlatformConditionString, config, platform);

            newPropertyGroup.Condition = newCondition;
        }
Exemple #4
0
        public ProjectPropertyElement AddProperty(string name, string unevaluatedValue)
        {
            ErrorUtilities.VerifyThrowArgumentLength(name, nameof(name));
            ErrorUtilities.VerifyThrowArgumentNull(unevaluatedValue, nameof(unevaluatedValue));

            ProjectPropertyElement newProperty = ContainingProject.CreatePropertyElement(name);

            newProperty.Value = unevaluatedValue;
            AppendChild(newProperty);

            return(newProperty);
        }
		void UpdateProperty(ProjectPropertyElement msbuildProjectProperty)
		{
			List<ProjectPropertyElement> sharpDevelopProjectProperties = FindSharpDevelopProjectProperties(msbuildProjectProperty);
			if (sharpDevelopProjectProperties.Count > 1) {
				// Ignore. Currently do not handle properties defined inside
				// property groups with conditions (e.g. OutputPath)
			} else if (!sharpDevelopProjectProperties.Any()) {
				AddPropertyToSharpDevelopProject(msbuildProjectProperty);
			} else if (HasMSBuildProjectPropertyBeenUpdated(msbuildProjectProperty, sharpDevelopProjectProperties.First())) {
				UpdatePropertyInSharpDevelopProject(msbuildProjectProperty);
			}
		}
		void UpdateProperty (ProjectPropertyElement msbuildProjectProperty)
		{
			return;

			List<ProjectPropertyElement> dotNetProjectProperties = FindDotNetProjectProperties (msbuildProjectProperty);
			if (dotNetProjectProperties.Count > 1) {
				// Ignore. Currently do not handle properties defined inside
				// property groups with conditions (e.g. OutputPath)
			} else if (!dotNetProjectProperties.Any ()) {
				AddPropertyToDotNetProject (msbuildProjectProperty);
			} else if (HasMSBuildProjectPropertyBeenUpdated (msbuildProjectProperty, dotNetProjectProperties.First ())) {
				UpdatePropertyInDotNetProject (msbuildProjectProperty);
			}
		}
Exemple #7
0
        /// <summary>
        /// Parse a ProjectPropertyGroupElement from the element
        /// </summary>
        private ProjectPropertyGroupElement ParseProjectPropertyGroupElement(XmlElementWithLocation element, ProjectElementContainer parent)
        {
            ProjectXmlUtilities.VerifyThrowProjectAttributes(element, s_validAttributesOnlyConditionAndLabel);

            ProjectPropertyGroupElement propertyGroup = new ProjectPropertyGroupElement(element, parent, _project);

            foreach (XmlElementWithLocation childElement in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
            {
                ProjectPropertyElement property = ParseProjectPropertyElement(childElement, propertyGroup);

                propertyGroup.AppendParentedChildNoChecks(property);
            }

            return(propertyGroup);
        }
Exemple #8
0
        /// <summary>
        /// Parse a ProjectPropertyGroupElement from the element
        /// </summary>
        private ProjectPropertyGroupElement ParseProjectPropertyGroupElement(XmlElementWithLocation element, ProjectElementContainer parent)
        {
            ProjectXmlUtilities.VerifyThrowProjectAttributes(element, ValidAttributesOnlyConditionAndLabel);

            ProjectPropertyGroupElement propertyGroup = new ProjectPropertyGroupElement(element, parent, _project);

            foreach (XmlElementWithLocation childElement in ProjectXmlUtilities.GetVerifyThrowProjectChildElements(element))
            {
                ProjectXmlUtilities.VerifyThrowProjectAttributes(childElement, ValidAttributesOnlyConditionAndLabel);
                XmlUtilities.VerifyThrowProjectValidElementName(childElement);
                ProjectErrorUtilities.VerifyThrowInvalidProject(!XMakeElements.ReservedItemNames.Contains(childElement.Name) && !ReservedPropertyNames.IsReservedProperty(childElement.Name), childElement.Location, "CannotModifyReservedProperty", childElement.Name);

                // All children inside a property are ignored, since they are only part of its value
                ProjectPropertyElement property = new ProjectPropertyElement(childElement, propertyGroup, _project);

                propertyGroup.AppendParentedChildNoChecks(property);
            }

            return(propertyGroup);
        }
		void SetPropertyInSharpDevelopProject(ProjectPropertyElement msbuildProjectProperty)
		{
			sharpDevelopProject.SetProperty(msbuildProjectProperty.Name, msbuildProjectProperty.Value, treatPropertyValueAsLiteral: false);
		}
 void AddPropertyToSharpDevelopProject(ProjectPropertyElement msbuildProjectProperty)
 {
     SetPropertyInSharpDevelopProject(msbuildProjectProperty);
     result.AddPropertyAdded(msbuildProjectProperty.Name);
 }
 void SetPropertyInSharpDevelopProject(ProjectPropertyElement msbuildProjectProperty)
 {
     sharpDevelopProject.SetProperty(msbuildProjectProperty.Name, msbuildProjectProperty.Value);
 }
 void UpdatePropertyInSharpDevelopProject(ProjectPropertyElement msbuildProjectProperty)
 {
     SetPropertyInSharpDevelopProject(msbuildProjectProperty);
     result.AddPropertyUpdated(msbuildProjectProperty.Name);
 }
 private static bool IsPtvsTargetsFileProperty(ProjectPropertyElement p) {
     return p.Name == "PtvsTargetsFile";
 }
 bool HasMSBuildProjectPropertyBeenUpdated(ProjectPropertyElement msbuildProjectProperty, ProjectPropertyElement sharpDevelopProjectProperty)
 {
     return msbuildProjectProperty.Value != sharpDevelopProjectProperty.Value;
 }
Exemple #15
0
		public XmlProjectProperty (Project project, ProjectPropertyElement xml, PropertyType propertyType, bool isImported)
			: base (project, propertyType, xml.Name)
		{
			this.xml = xml;
			this.is_imported = isImported;
			UpdateEvaluatedValue ();
		}
		void SetPropertyInDotNetProject (ProjectPropertyElement msbuildProjectProperty)
		{
			throw new NotImplementedException();
			//dotNetProject.SetProperty (msbuildProjectProperty.Name, msbuildProjectProperty.Value);
		}
		bool HasMSBuildProjectPropertyBeenUpdated (ProjectPropertyElement msbuildProjectProperty, ProjectPropertyElement dotNetProjectProperty)
		{
			return msbuildProjectProperty.Value != dotNetProjectProperty.Value;
		}
 private static bool IsGuidValue(ProjectPropertyElement e) {
     Guid g;
     return Guid.TryParse(e.Value, out g);
 }
		void AddPropertyToDotNetProject (ProjectPropertyElement msbuildProjectProperty)
		{
			SetPropertyInDotNetProject (msbuildProjectProperty);
			result.AddPropertyAdded (msbuildProjectProperty.Name);
		}
		List<ProjectPropertyElement> FindDotNetProjectProperties (ProjectPropertyElement msbuildProjectProperty)
		{
			return new List <ProjectPropertyElement> ();
//			lock (dotNetProject.SyncRoot) {
//				return dotNetProject
//					.MSBuildProjectFile
//					.Properties
//					.Where (property => String.Equals (property.Name, msbuildProjectProperty.Name, StringComparison.OrdinalIgnoreCase))
//					.ToList ();
//			}
		}
		void UpdatePropertyInDotNetProject (ProjectPropertyElement msbuildProjectProperty)
		{
			SetPropertyInDotNetProject (msbuildProjectProperty);
			result.AddPropertyUpdated (msbuildProjectProperty.Name);
		}