If the solution format would have been MSBuild compatible, you would just have added a Condition="$(BuildingInsideVisualStudio)= true" to the unsupported project types.
However, as the solution format isnot msbuild compatible, it is not this simple as msbuild transforms the solution file into a msbuild compatible project file in-memory, and this is automagically performed.
You can however get msbuild to dump the generated file to disk by setting an environment variable MSBuildEmitSolution to 1 and then do the build operation.
It might be possible to manually modify this generated project file and add Condition attributes appropriately, but this is just speculations..
Easier is to build using devenv (which obviously means that Visual studio needs to be installed)