Resolve error MSB4126: The specified solution configuration "Debug|x64" is invalid
insights Stats
Issue context
Create a .NET solution with .NET CLI:
dotnet new sln
When building with dotnet build command, you may encounter the following error:
error MSB4126: The specified solution configuration "Debug|x64" is invalid
You may also encounter similar errors if you CPU is different from x64.
There are at least two approaches to address this issue.
Remove Platform environment variable
This issue usually occurs because there is one environment variable named Platform
or platform
with value as x64
. You can remove if from your system environment variables or session environment variables.
Add x64 platform configuration
Another approach is to add one configuration for x64
directly in your solution.
Here are the steps to resolve this issue:
Open your solution file (.sln) in a text editor.
Look for the
GlobalSection(SolutionConfigurationPlatforms)
section.Under this section, ensure that there is an entry for
Debug|x64
. If not, add it. The section should look something like this:
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug\|x64 = Debug\|x64
Release\|x64 = Release\|x64
EndGlobalSection
Save the solution file and try to build again.
Everything about .NET framework, .NET Core, .NET Standard, .NET 5 and .NET 6.