CMAKE+MSBUILD: Solution file error MSB5004: The solution file has two projects named "MyProject"

It appears that cmake juce generates a group containing the targets (aax, vst…) with the same name as the project containing the shared code. In the .sln file this group is marked as a project.
This causes an issue while using msbuild script command:
pathToBuild/myproject.sln : Solution file error MSB5004: The solution file has two projects named “myproject”.

Naming this group differently like “MyProjectTargets” would fix this issue.

There is however a workaround by opening directly the .vcxproj in msbuild intead of the .sln.

Thanks.

The ‘all targets’ group has the suffix _All - if there are duplicate targets appearing, I think the cause is likely to be elsewhere. (I haven’t seen this issue before, and I was using Visual Studio this morning.)

Does this happen on all JUCE/CMake projects, or just one specific project? If just one project, could you share the CMakeLists for the project, or ideally, the smallest CMakeLists which reproduces the problem? Also, which version of Visual Studio are you using?