26

I get this error in VS:

Current solution contains incorrect configuration mappings. It may cause projects to not work correctly. Open the Configuration Manager to fix them.

I then open Configuration Manager, and click on Close and the error goes away.

I can then see it made these changes to my .sln file:

enter image description here

Why were the original configuration mappings incorrect?

David Klempfner
  • 8,700
  • 20
  • 73
  • 153

4 Answers4

34

It's not uncommon that shared projects get included in the list of projects to build. Not sure it applies to all cases but clearing everything between:

GlobalSection(ProjectConfigurationPlatforms) = postSolution

and

EndGlobalSection

in the .sln file and then reloading the solution will at least solve those.

jool
  • 1,491
  • 12
  • 14
  • I removed GlobalSection, but Visual Studio added it back again directly with changes very similar to the OP. The actual answer to the question is probably related to the configuration not being available in the project. – llessurt Jun 14 '23 at 12:58
3

A colleague just had this message pop up, and it turned out it was because the sln file had been updated (automatically, by Visual Studio) to try and compile a Shared Project (which is nonsense)

Long story short, the fix was to edit the sln file and remove the references to the Shared Project, very similar to the last time Shared Projects caused me an issue as documented here

PaulG
  • 13,871
  • 9
  • 56
  • 78
2

In my case, it was because the .csproj file had the wrong profiles compared to the global profiles.

Ensure that the tag has the correct value. You'll probably find in said project something like:

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

It should look like

<Configuration Condition=" '$(Configuration)' == '' ">Debug_VSTS</Configuration>
Nielsvh
  • 1,151
  • 1
  • 18
  • 31
-2

In my case, it appears as a message bar on top of my code pages in VS, when I clicked on it, it opened the Build Configuration and as soon as I closed it, the message disappeared.

Amir978
  • 857
  • 3
  • 15
  • 38
  • This will just map the projects to some default. It doesn't fix the problem and maps solution-level configurations to whatever defaults the IDE feels like. – Nielsvh Sep 14 '22 at 22:19