SLN Configuration File : mapping issues

81 views Asked by At

I want to customise the sln file of my solution to manage:

  • 3 projects
  • 5 configurations: Debug, Production_total, Production_Partial, Release and Recette

Each configuration should use "Any CPU" platform.

I came to this:


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32922.545
MinimumVisualStudioVersion = 10.0.40219.1
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Dumbow2", "Dumbow 2\Dumbow2.vbproj", "{101E24DB-EFB4-4375-A206-AC3FD4518FE7}"
    ProjectSection(ProjectDependencies) = postProject
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3} = {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}
    EndProjectSection
EndProject
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Dumbow2_update_version_reference", "Dumbow2_update_version_reference\Dumbow2_update_version_reference.vbproj", "{9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}"
    ProjectSection(ProjectDependencies) = postProject
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133} = {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}
    EndProjectSection
EndProject
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Dumbow2_prebuilt", "Dumbow2_prebuilt\Dumbow2_prebuilt.vbproj", "{0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU       
        Production_Partial|Any CPU = Production_Partial|Any CPU
        Production_Total|Any CPU = Production_Total|Any CPU
        Release|Any CPU = Release|Any CPU       
        Recette|Any CPU = Recette|Any CPU       
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Debug|Any CPU.ActiveCfg = Debug|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Debug|Any CPU.Build.0 = Debug|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Production_Total|Any CPU.ActiveCfg = Production_Total|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Production_Total|Any CPU.Build.0 = Production_Total|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Production_Partial|Any CPU.ActiveCfg = Production_Partial|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Production_Partial|Any CPU.Build.0 = Production_Partial|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Release|Any CPU.ActiveCfg = Release|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Release|Any CPU.Build.0 = Release|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Recette|Any CPU.ActiveCfg = Recette|x64
        {101E24DB-EFB4-4375-A206-AC3FD4518FE7}.Recette|Any CPU.Build.0 = Recette|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Debug|Any CPU.ActiveCfg = Debug|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Debug|Any CPU.Build.0 = Debug|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Production_Total|Any CPU.ActiveCfg = Production_Total|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Production_Total|Any CPU.Build.0 = Production_Total|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Production_Partial|Any CPU.ActiveCfg = Production_Partial|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Production_Partial|Any CPU.Build.0 = Production_Partial|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Release|Any CPU.ActiveCfg = Release|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Release|Any CPU.Build.0 = Release|x64
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Recette|Any CPU.ActiveCfg = Recette|x64      
        {9DD6A3BA-4177-477A-A4BF-DEC95B7984C3}.Recette|Any CPU.Build.0 = Recette|x64        
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Debug|Any CPU.ActiveCfg = Debug|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Debug|Any CPU.Build.0 = Debug|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Production_Total|Any CPU.ActiveCfg = Production_Total|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Production_Total|Any CPU.Build.0 = Production_Total|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Production_Partial|Any CPU.ActiveCfg = Production_Partial|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Production_Partial|Any CPU.Build.0 = Production_Partial|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Release|Any CPU.ActiveCfg = Release|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Release|Any CPU.Build.0 = Release|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Recette|Any CPU.ActiveCfg = Recette|x64
        {0B3CCBC2-9BE8-4B03-9D91-86ED2474F133}.Recette|Any CPU.Build.0 = Recette|x64
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {D8CF22E9-68E7-417A-8707-BAF2C4AC2391}
    EndGlobalSection
EndGlobal

The solution loads in Visual Studio but I got "Current solution contains incorrect configuration mappings". Did the issue come from that "customised" SLN File or did it come from the fact there is some mismatches between the SLN files and the vbproj files of each project within the solution?

Last question: in Visual Studio UI, only two configuration display. I don't get why. enter image description here

1

There are 1 answers

0
Bowman Zhu-MSFT On BEST ANSWER

I am able to reproduce your situation:

enter image description here

There is a problem with your .sln file.

GlobalSection(ProjectConfigurationPlatforms) section shows configuration mappings to x64, while you intended to use Any CPU.

On my side it is:

enter image description here

Once I change to this:

enter image description here

The issue will disappear:

enter image description here

If you manually write the sln like original(map to x64), you should be able to reproduce the issue again.

As Jonathan said, please don't try to write the sln file manually, otherwise, there may be some unexpected errors.

in Visual Studio UI, only two configuration display. I don't get why.

You need to reopen the vs after changing manually and to tell the truth, the vs doesn't only consider your writing, it also considers the caches in other places, it will reformat after reload. I suggest you not write it, otherwise, it will make something unexpected.

But I can also reproduce this situation.

This is my sln file:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp7", "ConsoleApp7.csproj", "{D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}"
EndProject
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ConsoleApp8", "..\ConsoleApp8\ConsoleApp8.vbproj", "{AAC48834-364F-4CD9-81F8-34D5264A1A05}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU       
        Production_Partial|Any CPU = Production_Partial|Any CPU
        Production_Total|Any CPU = Production_Total|Any CPU
        Release|Any CPU = Release|Any CPU       
        Recette|Any CPU = Recette|Any CPU       
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Production_Partial|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Production_Partial|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Release|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test4|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test4|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test5|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test5|Any CPU.Build.0 = Release|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Debug|Any CPU.ActiveCfg = test2|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Debug|Any CPU.Build.0 = test2|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Production_Partial|Any CPU.ActiveCfg = Production_Partial|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Release|Any CPU.Build.0 = Release|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.test|Any CPU.ActiveCfg = test|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.test|Any CPU.Build.0 = test|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {4A4DFA2A-F099-4DDC-86E1-343A4B11F86A}
    EndGlobalSection
EndGlobal

And the active configuration is not loaded:

enter image description here

If you really want to write and make it work, please don't copy&paste(it may contains unexpected bytes), write it manually one by one, it works on my side:

For example, I write the section 'Recette' like this:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33530.505
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp7", "ConsoleApp7.csproj", "{D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}"
EndProject
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "ConsoleApp8", "..\ConsoleApp8\ConsoleApp8.vbproj", "{AAC48834-364F-4CD9-81F8-34D5264A1A05}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Production_Partial|Any CPU = Production_Partial|Any CPU
        Release|Any CPU = Release|Any CPU
        test|Any CPU = test|Any CPU
        Recette|Any CPU = Recette|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Production_Partial|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Production_Partial|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.Release|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test4|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test4|Any CPU.Build.0 = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test5|Any CPU.ActiveCfg = Release|Any CPU
        {D5EBDFAE-03A5-466C-9DE1-907AEDAE83CF}.test5|Any CPU.Build.0 = Release|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Debug|Any CPU.ActiveCfg = test2|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Debug|Any CPU.Build.0 = test2|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Production_Partial|Any CPU.ActiveCfg = Production_Partial|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.Release|Any CPU.Build.0 = Release|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.test|Any CPU.ActiveCfg = test|Any CPU
        {AAC48834-364F-4CD9-81F8-34D5264A1A05}.test|Any CPU.Build.0 = test|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {4A4DFA2A-F099-4DDC-86E1-343A4B11F86A}
    EndGlobalSection
EndGlobal

And it works:

enter image description here

Remember to write one by one, otherwise the changes will be droped by VS immediately(I suspect you add them all in one time.).

Anyway, I strongly do not recommend that you write by hand. This may cause a lot of problems. Although you can handwrite some of the things you encounter now, please only take it as a try(to better understand it). Please remember that VS not only refers to your manually written sln file, but also Lots of other binaries, caches and stuff like that.