Add an additional answer:
!/.vs/ <== include this folder to source control, folder only, nothing else
/.vs/* <== but ignore all files and sub-folder inside this folder
!/.vs/ProjectSettings.json <== but include this file to source control
!/.vs/config/ <== butthen include this folder to source control, folder only, nothing else
!/.vs/config/* <== then include all files inside the folder
here is result: