public override bool Execute()
        {
            foreach (ITaskItem item in ProjectJsonFiles)
            {
                string pathToProjectJson = item.GetMetadata("FullPath");

                JObject   root           = ProjectJsonUtils.ReadProject(pathToProjectJson);
                JProperty runtimeSection = root.Descendants().OfType <JProperty>().Where(property => property.Name == "runtimes").FirstOrDefault();

                if (runtimeSection == null)
                {
                    continue;
                }

                JObject ridObject = (JObject)runtimeSection.Value;

                if (!string.IsNullOrEmpty(FilterRuntimeId) && !ridObject.Descendants().OfType <JProperty>().Any(property => property.Name == FilterRuntimeId))
                {
                    continue;
                }

                Dictionary <string, JObject> obj = new Dictionary <string, JObject>();
                obj[ReplacementRuntimeId] = new JObject();

                runtimeSection.Value = JObject.FromObject(obj);

                ProjectJsonUtils.WriteProject(root, pathToProjectJson);
            }

            return(true);
        }
        public override bool Execute()
        {
            foreach (ITaskItem item in ProjectJsonFiles)
            {
                string pathToProjectJson = item.GetMetadata("FullPath");

                JObject root         = ProjectJsonUtils.ReadProject(pathToProjectJson);
                JObject buildOptions = (JObject)root["buildOptions"];

                if (buildOptions == null)
                {
                    root["buildOptions"] = JObject.FromObject(new Dictionary <string, string>()
                    {
                        { "publicSign", "true" }, { "keyFile", KeyFilePath }
                    });
                }
                else
                {
                    AddOrReplacePropertyValue(buildOptions, "publicSign", new JValue("true"));
                    AddOrReplacePropertyValue(buildOptions, "keyFile", new JValue(KeyFilePath));

                    buildOptions.Remove("delaySign");
                }

                ProjectJsonUtils.WriteProject(root, pathToProjectJson);
            }

            return(true);
        }
        private static bool ProjectTargetsAnyTFM(string pathToProjectJson, string[] candidateTFMs)
        {
            JObject project = ProjectJsonUtils.ReadProject(pathToProjectJson);

            return(project.Value <JObject>("frameworks").Properties().Select(p => p.Name).Any(tfm => candidateTFMs.Contains(tfm)));
        }