Beispiel #1
0
        protected bool InitializeTargetFrameworks()
        {
            bool add_frameworks(IEnumerable <string> fwStrings)
            {
                if (fwStrings == null)
                {
                    return(false);
                }

                foreach (var curFW in fwStrings)
                {
                    //TODO: need to figure out how to determine if it's an app
                    var newTF = new TargetFramework();

                    if (!newTF.Initialize(curFW, Logger))
                    {
                        return(false);
                    }

                    TargetFrameworks.Add(newTF);
                }

                return(true);
            }

            TargetFrameworks.Clear();

            var singleFramework = ProjectElement.Descendants("TargetFramework").FirstOrDefault()?.Value;

            if (singleFramework != null)
            {
                return(add_frameworks(new[] { singleFramework }));
            }

            if (!add_frameworks(ProjectElement
                                .Descendants("TargetFrameworks").FirstOrDefault()?.Value
                                .Split(';')))
            {
                return(false);
            }

            return(true);
        }