Edit

Share via


MSB3103 diagnostic code

This article describes the MSB3103 error code.

Message text

MSB3103: Invalid Resx file.

Description

This error occurs when there's an issue with a .resx resource file. This error indicates that the .resx file can't be properly read or processed, often due to incorrect file paths or references.

Common causes

The following causes can result in this error:

Cause Description Example
Missing or inaccessible resources The .resx file references external resources (for example, images or files) that aren't present in the expected location or are inaccessible. A file path specified in the .resx file is incorrect or points to a missing file.
Incorrect type reference The .resx file referenced a type that can't be found. A typo in a type reference in a ResXFile reference, or a type that isn't available for some reason.
Corrupted files The .resx file or one of its dependencies is corrupted. The .resx file contains unreadable characters and the build isn't able to process the file.

Real-world scenarios

Here are some real-world scenarios that can lead to this error:

  • Project migration: Upgrading a legacy project from .NET Framework to .NET Core or .NET 6+ where existing .resx files contain elements or attributes that aren't compatible with the newer frameworks.

  • Manual edits to .resx files: Manual edits to .resx files that inadvertently introduce syntax errors or invalid data.

  • Broken resource links: References to external files (for example, images or icons) in .resx files where the files aren't included in the project or accessible during the build.

  • Corrupted .resx files: Files are corrupted due to version control conflicts or file encoding changes.

Resolution

  • Check resource entries: If external resources are referenced, verify their paths and existence.

  • Use the ResX Resource Manager: Consider using tools like ResX Resource Manager to validate and manage .resx files.

  • Update for framework compatibility: Review changes in resource handling for the target framework. Update .resx files to align with the requirements of the new framework.

  • Revert to a known good state: If the .resx file is corrupted, revert to a previous version from source control.

For more information, see MSBuild Documentation and ResX Resource Manager.

Applies to

All versions of MSBuild