private ProjectItemGroupElement CreateItemGroupAtEndOfProject(ProjectRootElement csproj) { var itemGroup = csproj.CreateItemGroupElement(); csproj.InsertBeforeChild(itemGroup, csproj.LastChild); return(itemGroup); }
private static void InitializeVSIXProjectItems(ProjectRootElement root) { ProjectElement lastChild = root.LastChild; ProjectItemGroupElement group = root.CreateItemGroupElement(); root.InsertBeforeChild(group, lastChild); group.AddItem("None", "source.extension.vsixmanifest"); }
public override bool Execute() { ProjectRootElement project = ProjectRootElement.Create(); var propertyGroup = project.CreatePropertyGroupElement(); project.AppendChild(propertyGroup); propertyGroup.AddProperty("AzureDevOpsCollectionUri", AzureDevOpsCollectionUri ?? "undefined"); propertyGroup.AddProperty("AzureDevOpsProject", AzureDevOpsProject ?? "undefined"); propertyGroup.AddProperty("AzureDevOpsBuildId", AzureDevOpsBuildId.ToString()); var itemGroup = project.CreateItemGroupElement(); project.AppendChild(itemGroup); if (ItemsToSign != null) { foreach (var itemToSign in ItemsToSign) { var filename = itemToSign.ItemSpec.Replace('\\', '/'); { var metadata = itemToSign.CloneCustomMetadata() as Dictionary <string, string>; itemGroup.AddItem("ItemsToSign", Path.GetFileName(itemToSign.ItemSpec), metadata); } } } if (StrongNameSignInfo != null) { foreach (var signInfo in StrongNameSignInfo) { itemGroup.AddItem("StrongNameSignInfo", Path.GetFileName(signInfo.ItemSpec), signInfo.CloneCustomMetadata() as Dictionary <string, string>); } } if (FileSignInfo != null) { foreach (var signInfo in FileSignInfo) { itemGroup.AddItem("FileSignInfo", signInfo.ItemSpec, signInfo.CloneCustomMetadata() as Dictionary <string, string>); } } if (FileExtensionSignInfo != null) { foreach (var signInfo in FileExtensionSignInfo) { itemGroup.AddItem("FileExtensionSignInfo", signInfo.ItemSpec, signInfo.CloneCustomMetadata() as Dictionary <string, string>); } } project.Save(ManifestPath); return(true); }
public static ProjectItemGroupElement FindUniformOrCreateItemGroupWithCondition(this ProjectRootElement root, string projectItemElementType, string framework) { var lastMatchingItemGroup = FindExistingUniformItemGroupWithCondition(root, projectItemElementType, framework); if (lastMatchingItemGroup != null) { return(lastMatchingItemGroup); } ProjectItemGroupElement ret = root.CreateItemGroupElement(); string condStr; if (TryGetFrameworkConditionString(framework, out condStr)) { ret.Condition = condStr; } root.InsertAfterChild(ret, root.LastItemGroup()); return(ret); }