[Dev] Visual Studio 2019 Impressions

Quintillus

Archiving Civ3 Content
Moderator
Supporter
Joined
Mar 17, 2007
Messages
8,400
Location
Ohio
Follow the conclusion of my Rider trial (which concluded it's a great tool for development, but one that should not be purchased currently due to its development being largely in Russia), I'm taking a more serious look at Visual Studio 2019 Community. Expectations are lower, but it still might provide a boost over VSCode.

I'll first note how to launch C7 from VS2019. Open C7.sln, and then go to Project -> C7 Properties. Fill in the sections like the following (using the local paths to C7 on your system). Make sure to change the "Launch" dropdown to "Executable".

upload_2022-3-7_14-52-32.png


Starting C7 with the green arrow with "C7" next to it in the toolbar will now successfully launch C7.

I haven't yet figured out how to get it to hit breakpoints. Will probably have some refactoring impressions before too long, which along with debugging are the two areas where I expect to see the greatest improvements in an IDE versus VSCode.
 
I've now figured out debugging/breakpoints with Visual Studio 2019. The changes are on the VisualStudioDebugging branch, and my commit notes are:

There's an extension for C# integration + debugging in Visual Studio at https://github.com/godotengine/godot-csharp-visualstudio/tree/1.x, but it's a bit bugged, and hasn't worked smoothly since Godot 3.2.3 RC4 (https://github.com/godotengine/godot-csharp-visualstudio/issues/10). Eventually, I figured out how to get it working by following the guide at https://gist.github.com/31/302bab2630ddf8d90ab4aec0d358b538 .

To install the extension in the first place, you'll have to add the "Mobile Development with .NET" component of Visual Studio, although you can uncheck the optional Android sub-component of that addition.

Note that I'm using Visual Studio 2019 because I'm on Windows 8.1. However, reports are that even with the work-around to get it working, using the extension breaks IntelliSense on Visual Studio 2022 (soruce: https://github.com/godotengine/godot-csharp-visualstudio/issues/26). Thus, I recommend sticking with Visual Studio 2019 regardless.

Use the "Launch" debug target to start it, and it works. "Play in Editor" is the default but requires a Godot editor instance to be up, so I'm not sure why you'd prefer it unless you already had it up to use its GUI tools.

You can use the Visual Studio Installer to get that "Mobile Development with .NET" component.

The changes involve adding a stub project inside the C7 project that configurates Visual Studio. I haven't dug deep enough into Visual Studio projects to fully grok the why, but from what I can tell the project format changed somewhere around the time of Godot 3.2.3 RC4, and the stub project is a work-around to get debugging working again until a future change in Visual Studio (or maybe the extension).

This setup also gets the console output to go to the "Output" window in Visual Studio, instead of the standalone command-prompt like when run from Godot, which I found to be nice when using Rider.

Still haven't really done much development in Visual Studio, but I think the tooling is now configured adequately. Importantly, it also still launches just fine from the Godot editor itself.
 
from what I can tell the project format changed somewhere around the time of Godot 3.2.3 RC4

Pretty sure that's when they went from some former version of the .csproj file format to the "sdk format" Godot uses today. I saw that happen during the infancy of C7.

(Ok, I guess it's not a different format per se, but when the sdk is specified, a LOT of the other stuff disappears from the .csproj file which confused the heck out of me for a while.)
 
Flintlock is having some issues with the VSStub project causing C7 not to build; WildWeazel mentioned something similar on Linux. See the conversation at https://github.com/C7-Game/Prototype/issues/162

The key question is why does the VSStub project not cause any issues on my machine, but does on other people's? My guess is there's some difference in installed software, although given that it's a workaround to a bug, it could just be a flaky work-around.

The part that seems strange to me is that I'd expected the VSStub project would be invisible to the main C7 project - there are no references to VSStub from the main project, only the other way around. But I'm not really a .NET specialist, so there are some things going on that are deeper than what I understand well.
 
I'd expected the VSStub project would be invisible to the main C7 project - there are no references to VSStub from the main project,

It's in the C7.sln file which Godot created in the first place. So it goes and looks at all the .csproj files referenced in the .sln.
 
It's in the C7.sln file which Godot created in the first place. So it goes and looks at all the .csproj files referenced in the .sln.

Oh, right, forgot about the .sln. Man, I miss Java sometimes.
 
Top Bottom