private void UpdatePackageIdWithAppendValue(XContainer nuSpec) { if (string.IsNullOrWhiteSpace(AppendToPackageId)) { return; } var package = nuSpec.ElementAnyNamespace("package"); if (package == null) { throw new Exception(string.Format("The NuSpec file does not contain a <package> XML element. The NuSpec file appears to be invalid.")); } var metadata = package.ElementAnyNamespace("metadata"); if (metadata == null) { throw new Exception(string.Format("The NuSpec file does not contain a <metadata> XML element. The NuSpec file appears to be invalid.")); } var packageId = metadata.ElementAnyNamespace("id"); if (packageId == null) { throw new Exception(string.Format("The NuSpec file does not contain a <id> XML element. The NuSpec file appears to be invalid.")); } packageId.Value = string.Format("{0}.{1}", packageId.Value, AppendToPackageId.Trim()); }
private void UpdatePackageIdWithAppendValue(XmlDocument nuSpec) { if (StringHelper.IsNullOrWhiteSpace(AppendToPackageId)) { return; } var package = XmlElementExtensions.ElementAnyNamespace(nuSpec, "package"); if (package == null) { throw new Exception("The NuSpec file does not contain a <package> XML element. The NuSpec file appears to be invalid."); } var metadata = XmlElementExtensions.ElementAnyNamespace(package, "metadata"); if (metadata == null) { throw new Exception("The NuSpec file does not contain a <metadata> XML element. The NuSpec file appears to be invalid."); } var packageId = XmlElementExtensions.ElementAnyNamespace(metadata, "id"); if (packageId == null) { throw new Exception("The NuSpec file does not contain a <id> XML element. The NuSpec file appears to be invalid."); } packageId.InnerText = string.Format("{0}.{1}", packageId.InnerText, AppendToPackageId.Trim()); }
private void UpdatePackageIdWithAppendValue(XContainer nuSpec) { if (string.IsNullOrWhiteSpace(AppendToPackageId)) { return; } var packageId = GetPackageIdElementFromNuSpec(nuSpec); packageId.Value = $"{packageId.Value}.{AppendToPackageId.Trim()}"; }