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);
        }
Exemplo n.º 2
0
 internal MSBuildItemGroup(MSBuildProject parent, XmlElement elem)
     : base(elem)
 {
     this.parent = parent;
 }
Exemplo n.º 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;
 }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
        public static MSBuildProject LoadFrom(string fileName)
        {
            var project = new MSBuildProject();
            project.Load(fileName);

            return project;
        }
Exemplo n.º 8
0
        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;
        }