Edit

Share via


MSB4126 diagnostic code

This article describes the MSB4126 error code.

Message text

MSB4126: The specified solution configuration 'value' is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform='Any CPU') or leave those properties blank to use the default solution configuration.

Remarks

This error occurs when the solution configuration, which consists of the Configuration and Platform (for example, Release|Any CPU), is not valid for the current solution, or there was an error in the solution file that caused the configuration to be misinterpreted.

In Visual Studio, the solution configuration and platform are set by a drop-down box on the top toolbar. If you edit the configuration, the Configuration Manager dialog appears, and you can see the project configurations that build for each solution configuration. The project configurations are often the same as the solution configuration, but they can be different. You might change the project configurations independently for various reasons such as for performance. For example, you might select the Release configuration of some of the projects in the solution even in the Debug solution configuration, if they're not the focus of a current active development and debugging. See Create and edit configurations.

Resolution

For command line builds, check the command line syntax carefully, especially in arguments that provide the configuration and platform (/p:Configuration). Check for typos, incorrect quotes, and problems with escape characters.

Also, check the project file and any imported files (such as .props files) for any references to the $(Configuration) property for typos and other issues.

For solution builds, check the solution file itself for any corruption problems, such as bad or unintended edits to the solution file. This error could occur if something goes wrong with a project or solution that causes bad input for MSBuild as it attempts to determine the configuration for the build of one of the projects.

Applies to

All versions of MSBuild