nopSolutions/nopCommerce · error · NopException

All installation resources must have an attribute Name="Valu

Error message

All installation resources must have an attribute Name="Value".

What it means

Thrown by InstallationLocalizationService while parsing an installation language XML file: a LocaleResource node under //Language/LocaleResource is missing the 'Name' attribute. Every installation resource element must carry Name="...". This is a data-integrity check on the bundled localization XML.

Source

Thrown at src/Presentation/Nop.Web/Infrastructure/Installation/InstallationLocalizationService.cs:202

                Name = languageName,
                IsDefault = isDefault,
                IsRightToLeft = isRightToLeft,
            };

            //load resources
            var resources = xmlDocument.SelectNodes(@"//Language/LocaleResource");
            if (resources == null)
                continue;
            foreach (XmlNode resNode in resources)
            {
                if (resNode.Attributes == null)
                    continue;

                var resNameAttribute = resNode.Attributes["Name"];
                var resValueNode = resNode.SelectSingleNode("Value");

                if (resNameAttribute == null)
                    throw new NopException("All installation resources must have an attribute Name=\"Value\".");
                var resourceName = resNameAttribute.Value.Trim();
                if (string.IsNullOrEmpty(resourceName))
                    throw new NopException("All installation resource attributes 'Name' must have a value.'");

                if (resValueNode == null)
                    throw new NopException("All installation resources must have an element \"Value\".");
                var resourceValue = resValueNode.InnerText.Trim();

                language.Resources.Add(new InstallationLocaleResource
                {
                    Name = resourceName,
                    Value = resourceValue
                });
            }

            _availableLanguages.Add(language);
            _availableLanguages = _availableLanguages.OrderBy(l => l.Name).ToList();

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Open the offending installation language XML file and add the missing Name attribute to every <LocaleResource> element (e.g. <LocaleResource Name="Admin.Login">).
  2. Validate the XML against the official nopCommerce language pack schema/format before loading; diff against a known-good pack.
  3. Re-download or restore the default installation localization files from a clean nopCommerce release.

Example fix

// before (broken XML):
// <LocaleResource>
//   <Value>Dashboard</Value>
// </LocaleResource>

// after (fixed XML):
// <LocaleResource Name="Admin.Dashboard">
//   <Value>Dashboard</Value>
// </LocaleResource>
Defensive patterns

Strategy: validation

Validate before calling

// Validate the XML structure before loading resources
foreach (XmlNode resNode in xmlDocument.SelectNodes("//Language/LocaleResource"))
{
    if (resNode?.Attributes?[@"Name"] == null)
        throw new NopException($"LocaleResource at line missing Name attribute.");
}

Type guard

static bool IsValidResourceNode(XmlNode n) => n?.Attributes?["Name"] != null && n.SelectSingleNode("Value") != null;

Try / catch

catch (NopException exc) when (exc.Message.Contains("attribute Name"))
{
    // report the offending file and skip it rather than failing the whole install
    _logger.Error($"Malformed localization XML: {currentFile}", exc);
}

Prevention

When it happens

Trigger: Parsing an installation language XML (line ~202): resNode.Attributes["Name"] (resNameAttribute) is null for a LocaleResource node, so the loader cannot key the resource.

Common situations: A custom/edited language pack XML has a <LocaleResource> element without a Name attribute (malformed export); a translation tool stripped attributes; a manually merged XML introduced a broken node; a corrupted download of the language pack.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/c678855f05a059ae. Report an issue: GitHub.