Support Statement: Using a Custom Visual Studio Version (or SDK tools)

Overview

gmStudio integrates with .NET SDK tools and Visual Studio (VS) to make it convenient to do build testing and open translation results in the VS IDE.  gmStudio detects the installed Visual Studio (VS) versions and allows you to select one of them for your projects.  There is also a default setting for the VS Version used when creating new projects.  Sometimes support for the latest VS version lags behind what is implemented in the gmStudio user interface.  In that situation, you can manually configure gmStudio to use that VS version according..

There are two points of integration between gmStudio with VS:

1) Setting the operating environment before running the VS (devenv.exe) when you open the VS IDE do a build with MSBuild (e.g. running the appropriate vsvars32.bat or VsDevCmd.bat)
2) Setting version specific content when authoring .NET project files (e.g. Framework Version)

The details of the first integration are handled by the Template command script: SetEnv.cmd. The details of the second integration are handled by a gmSl script, AuthorText.gmsl. Both of these files may be made project-specific and modified to use an alternate version of Visual Studio.

Modifying the gmStudio project file

The VS version used by your gmStudio project is specified in the DevEnv element in the gmProj file:

<gmStudio>
  <Name>Calculator_csh</Name>
  <MigType>VBP</MigType>
  <DevEnv>VS2022</DevEnv> <-- set a name for the desired VS Version here
  <ProjFolder>C:\gmTestBed\Calculator\proj_csh</ProjFolder>
...
</gmStudio>

Modifying SetEnv.cmd for VS2022

Over the years, Microsoft has used different conventions for setting up the command line operating environment, so it takes some wrangling to support all the different versions that may be installed on a machine.   gmStudio ships with a Template command script, SetEnv.cmd, that sets the environment for command line build operations and for launching the VS IDE.   You may modify this file to support a version of VS not offered by the gmStudio IDE.  The first step is to Activate a project-specific copy of the default file in your project workspace.  You can do this from the Settings form. Next you modify the project-specific file to find and and execute the desired VS environment setup script (vsvars.bat or VSDevCmd.bat).

For VS2022, the following changes were made.   

Note, VS2022 has finally made it into the 64-bit "Program Files" folder, rather than "Program Files(x86)" folder and that detail must be considered when selecting an environment setup script for the desired VS.  Note that the script also handles choosing the VS product tier (Community, Professional, or Enterprise).

Not using Visual Studio?

The SetEnv file may also be used to select MSBuild tools installed with the .NET SDK tools for command line builds.  The VS IDE integration can be altered as well.  In fact,. all external tools used by gmStudio may be configured in the Application Configuration File (gmStudio.cfg).  Contact Great Migrations if you want help with using gmStudio with alternative tools. 

Modifying AuthorText.gmsl for VS2022

AuthorText.gmsl handles writing VS project files, AssemblyInfo files, and various other translation content not generated from legacy code.  AuthorText includes logic to set details of the project file based on the VS Version specified in your gmProj files.  You may modify a project-specific copy of AuthorText.gms to support a version of VS not offered in the gmStudio IDE.  The following changes were made in AuthorText.gmsl to support VS2022:

AuthorText.gmsl is part of the System Translation Configuration.   The process for customizing the System Translation Configuration is described in this article on Custom VB6 Language Replacement.   

Once these changes are made, gmStudio will integrate with VS2022.  Compared to VS2019, the difference from you will see is the VS2022 opens when you launch the VS IDE, the MSBuild installed with VS2022 will be used for build operations, and the .NET projects will specify FrameworkVersion=v4.8.