This is basically a bugfix for the source group issue of #19505. I tried to simplify and generalize the existing VS generator code that has a special handling for out of source files in csharp projects. I tried to be close to the original code, while cleaning it up a little. If you have suggestions for further improvements, please let me know.
The issue is that for out of source files (e.g. images, icons, or source code) they were all shown directly in the root path of the project in VS. I added the possibility to be able to define source groups for out of source files so they can grouped together just like in C++ projects.