public static FrameworkName Detect(MSBuildProject project)
        {
            var group = project.PropertyGroups.FirstOrDefault(x => x.Properties.Any(p => p.Name.Contains("TargetFramework")));
            var identifier = DefaultIdentifier;
            var versionString = DefaultFrameworkVersion;
            string profile = null;

            if (group != null)
            {
                identifier = group.GetPropertyValue("TargetFrameworkIdentifier") ?? DefaultIdentifier;
                versionString = group.GetPropertyValue("TargetFrameworkVersion") ?? DefaultFrameworkVersion;
                profile = group.GetPropertyValue("TargetFrameworkProfile");
            }

            var version = Version.Parse(versionString.Replace("v", "").Replace("V", ""));

            return new FrameworkName(identifier, version, profile);
        }
 internal MSBuildItemGroup(MSBuildProject parent, XmlElement elem)
     : base(elem)
 {
     this.parent = parent;
 }
Exemple #3
0
 public MSBuildPropertyGroup(MSBuildProject parent, XmlElement elem)
     : base(elem)
 {
     this.parent = parent;
 }
 public MSBuildPropertyGroup(MSBuildProject parent, XmlElement elem)
     : base(elem)
 {
     this.parent = parent;
 }
 internal MSBuildItemGroup(MSBuildProject parent, XmlElement elem)
     : base(elem)
 {
     this.parent = parent;
 }
        private static MSBuildProject create(string assemblyName, string text)
        {
            text = text
                .Replace("FUBUPROJECTNAME", assemblyName);

            var project = new MSBuildProject();
            project.doc = new XmlDocument
            {
                PreserveWhitespace = false
            };

            project.doc.LoadXml(text);

            return project;
        }
        public static MSBuildProject LoadFrom(string fileName)
        {
            var project = new MSBuildProject();
            project.Load(fileName);

            return project;
        }
        public static MSBuildProject Create(string assemblyName)
        {
            var text = Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(MSBuildProject),"Project.txt").ReadAllText();

            text = text
                .Replace("FUBUPROJECTNAME", assemblyName)
                .Replace("GUID", Guid.NewGuid().ToString());

            var project = new MSBuildProject();
            project.doc = new XmlDocument
            {
                PreserveWhitespace = false
            };

            project.doc.LoadXml(text);

            return project;
        }