Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClickOnce: improve application manifest file detection #773

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

dtivel
Copy link
Collaborator

@dtivel dtivel commented Oct 11, 2024

Resolve #681

This PR replaces #758.

CC @clairernovotny, @javierdlg, @jackmtpt

@dtivel dtivel requested a review from a team as a code owner October 11, 2024 23:44
Comment on lines +301 to +314
// there should only be a single result here, if the file is a valid clickonce manifest.
XmlNodeList dependentAssemblies = xmlDoc.GetElementsByTagName("dependentAssembly");
if (dependentAssemblies.Count != 1)
{
Logger.LogDebug(Resources.ApplicationManifestNotFound);
return false;
}

XmlNode? node = dependentAssemblies.Item(0);
if (node is null || node.Attributes is null)
{
Logger.LogDebug(Resources.ApplicationManifestNotFound);
return false;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a bug here. The comment asserts that there should only be one dependentAssembly element. However, it seems that there can be multiple.

From https://learn.microsoft.com/visualstudio/deployment/dependency-element-clickonce-deployment?view=vs-2022#elements-and-attributes:

The dependency element is required. It has no attributes. A deployment manifest can have multiple dependency elements.

This means this change would break users with multiple dependency elements. This method needs smarter application manifest identification.

{
internal interface IXmlDocumentLoader
{
XmlDocument Load(FileInfo file);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why you picked XmlDocument instead of XDocument here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sign many applications and manifestfiles in batch for click-once
3 participants