public override void Update(string file) { var document = DocumentHelper.GetXDocument(file); var directoryName = Path.GetDirectoryName(file) + ""; if (IsApplicationProject(document)) { AddRequiredReferences(document, file); } UpdateReferences(document, directoryName, file); UpdateConfig(file); if (SyncConfigurations(document)) { DocumentHelper.Save(document, file); } var licElement = document.Descendants().FirstOrDefault(element => element.Name.LocalName == "EmbeddedResource" && element.Attribute("Include").Value == @"Properties\licenses.licx"); if (licElement != null) { licElement.Remove(); DocumentHelper.Save(document, file); } var combine = Path.Combine(Path.GetDirectoryName(file) + "", @"Properties\licenses.licx"); if (File.Exists(combine)) { File.Delete(combine); } UpdateVs2010Compatibility(document, file); }
public override void Update(string file) { var document = DocumentHelper.GetXDocument(file); var versionElement = document.Descendants().First(element => element.Name.LocalName == "version"); versionElement.Value = _version; var dependenciesElement = document.Descendants().FirstOrDefault(element => element.Name.LocalName.ToLower() == "dependencies"); if (dependenciesElement != null) { foreach (var element in dependenciesElement.Elements()) { element.SetAttributeValue("version", _version); } } DocumentHelper.Save(document, file); }
bool HasReferenceRequirementInReferenceProjects(XDocument document, string reference) { var documents = document.Descendants().Where(element => element.Name.LocalName == "ProjectReference").Select(element => DocumentHelper.GetXDocument(Path.GetFullPath(element.Attribute("Include").Value))); return(documents.Any(xDocument => HasReferenceRequirementInProject(xDocument, reference))); }