提问人:8oris 提问时间:11/17/2023 更新时间:11/20/2023 访问量:32
SLN配置文件:映射问题
SLN Configuration File : mapping issues
问:
我想自定义解决方案的 sln 文件以管理:
- 3个项目
- 5 种配置:调试、Production_total、Production_Partial、发布和接收
每个配置都应使用“任何 CPU”平台。
我得出这个结论:
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
该解决方案在 Visual Studio 中加载,但我收到“当前解决方案包含不正确的配置映射”。 问题是来自“自定义”SLN 文件,还是来自解决方案中每个项目的 SLN 文件和 vbproj 文件之间存在一些不匹配的事实?
答:
我能够重现您的情况:
您的 .sln 文件有问题。
GlobalSection(ProjectConfigurationPlatforms)
部分显示了 的配置映射,而您打算使用 。x64
Any CPU
在我这边,它是:
一旦我改成这个:
问题将消失:
如果您像 original(map to x64) 一样手动编写 sln,您应该能够再次重现该问题。
正如 Jonathan 所说,请不要尝试手动编写 sln 文件,否则可能会出现一些意想不到的错误。
在 Visual Studio UI 中,仅显示两个配置。我不明白为什么。
手动更改后需要重新打开 vs,说实话,vs 不仅会考虑您的写作,还会考虑其他地方的缓存,重新加载后会重新格式化。我建议你不要写它,否则,它会做出一些意想不到的事情。
但我也可以重现这种情况。
这是我的sln文件:
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
并且未加载活动配置:
如果你真的想写并让它工作,请不要复制和粘贴(它可能包含意外的字节),一个接一个地手动编写,它在我这边工作:
例如,我这样写“Recette”部分:
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
它有效:
记得一个接一个地写,否则更改会立即被 VS 删除(我怀疑你一次性将它们全部添加。
无论如何,我强烈建议您不要手写。这可能会导致很多问题。虽然你可以手写你现在遇到的一些事情,但请只把它当作一个尝试(为了更好地理解它)。请记住,VS 不仅指您手动编写的 sln 文件,还指许多其他二进制文件、缓存和类似的东西。
评论