Esempio n. 1
0
        public AssemblyReference(FilePath path, string aliases = null)
        {
            FilePath = path;

            var properties = new MSBuildPropertyGroupEvaluated(null);

            if (aliases != null)
            {
                var property = new MSBuildPropertyEvaluated(null, nameof(Aliases), aliases, aliases);
                properties.SetProperty(nameof(Aliases), property);
            }
            metadata = properties;
        }
Esempio n. 2
0
 public AssemblyReference(FilePath path, IReadOnlyPropertySet metadata)
 {
     FilePath      = path;
     this.metadata = metadata;
 }
Esempio n. 3
0
        public static void ReadObjectProperties(this IReadOnlyPropertySet pset, object ob, Type typeToScan, bool includeBaseMembers = false)
        {
            DataSerializer ser   = new DataSerializer(Services.ProjectService.DataContext);
            var            props = Services.ProjectService.DataContext.GetProperties(ser.SerializationContext, ob);

            var mso = pset as IMSBuildProjectObject;

            if (mso != null && mso.ParentProject != null)
            {
                ser.SerializationContext.BaseFile = mso.ParentProject.FileName;
            }
            ser.SerializationContext.DirectorySeparatorChar = '\\';

            foreach (var prop in props)
            {
                if (prop.IsExternal)
                {
                    continue;
                }
                object readVal = null;
                if (prop.PropertyType == typeof(FilePath))
                {
                    FilePath def = (string)prop.DefaultValue;
                    readVal = pset.GetPathValue(prop.Name, def);
                }
                else if (prop.DataType is PathDataType && prop.PropertyType == typeof(string))
                {
                    FilePath def = (string)prop.DefaultValue;
                    readVal = pset.GetPathValue(prop.Name, def);
                    readVal = readVal.ToString();
                }
                else if (prop.PropertyType == typeof(string))
                {
                    readVal = pset.GetValue(prop.Name, (string)prop.DefaultValue);
                }
                else if (prop.DataType.IsSimpleType)
                {
                    readVal = pset.GetValue(prop.Name, prop.PropertyType, prop.DefaultValue);
                }
                else if (prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(Nullable <>))
                {
                    readVal = pset.GetValue(prop.Name, prop.PropertyType, prop.DefaultValue);
                }
                else
                {
                    var val = pset.GetValue(prop.Name);
                    if (!string.IsNullOrEmpty(val))
                    {
                        try {
                            if (!prop.WrapObject)
                            {
                                val = "<a>" + val + "</a>";
                            }
                            var data = XmlConfigurationReader.DefaultReader.Read(new XmlTextReader(new StringReader(val)));
                            if (prop.HasSetter && prop.DataType.CanCreateInstance)
                            {
                                readVal = prop.Deserialize(ser.SerializationContext, ob, data);
                            }
                            else if (prop.DataType.CanReuseInstance)
                            {
                                // Try to deserialize over the existing instance
                                prop.Deserialize(ser.SerializationContext, ob, data, prop.GetValue(ob));
                                continue;
                            }
                            else
                            {
                                throw new InvalidOperationException("The property '" + prop.Name + "' does not have a setter.");
                            }
                        } catch (Exception ex) {
                            LoggingService.LogError("Cound not read project property '" + prop.Name + "'", ex);
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                prop.SetValue(ob, readVal);
            }
        }
Esempio n. 4
0
 internal FrameworkReference(string include, IReadOnlyPropertySet metadata)
 {
     Include = include;
     TargetingPackVersion = metadata.GetValue("TargetingPackVersion");
 }
Esempio n. 5
0
 public TargetEvaluationResult(BuildResult buildResult, IEnumerable <IMSBuildItemEvaluated> items, IReadOnlyPropertySet properties)
 {
     this.buildResult = buildResult;
     this.items       = items;
     this.properties  = properties;
 }
		public TargetEvaluationResult (BuildResult buildResult, IEnumerable<IMSBuildItemEvaluated> items, IReadOnlyPropertySet properties)
		{
			this.buildResult = buildResult;
			this.items = items;
			this.properties = properties;
		}