When I build unity it closes the files I have open in Visual Studio. How do I stop this?

When I build unity it closes the files I have open in Visual Studio.

Same issue here. It seems to be related to any files that aren’t part of the project from the perspective of Unity itself.

Go here:
Project settings → Editor… and add 'Json" or whatever the extension is to the “Additional extension to include” option. Then in Visual Studio select “Show all files” and then right click on the file in question… From there select “Include in Project”.