diff --git a/src/WingetCreateCore/Common/PackageParser.cs b/src/WingetCreateCore/Common/PackageParser.cs index 447fefc6..5b565838 100644 --- a/src/WingetCreateCore/Common/PackageParser.cs +++ b/src/WingetCreateCore/Common/PackageParser.cs @@ -814,12 +814,11 @@ private static bool ParseExeInstallerType(string path, Installer baseInstaller, { try { - ManifestResource rc = new ManifestResource(); + XmlDocument manifest = GetManifest(path); InstallerType? installerTypeEnum; try { - rc.LoadFrom(path); - string installerType = rc.Manifest.DocumentElement + string installerType = manifest?.DocumentElement? .GetElementsByTagName("description") .Cast() .FirstOrDefault()? @@ -1109,5 +1108,26 @@ private static string RemoveInvalidCharsFromString(string value) { return Regex.Replace(value, InvalidCharacters, string.Empty); } + + /// + /// Gets the manifest from the specified path. + /// The path to the manifest. + /// XmlDocument of the manifest. + private static XmlDocument GetManifest(string path) + { + var rc = new ManifestResource(); + var manifest = new XmlDocument(); + + try + { + rc.LoadFrom(path); + manifest = rc.Manifest; + } + catch (Exception ex) + { + } + + return manifest; + } } }