Q. How can I modify a System gmSL routine?
A. Add a gmSL block replacing the method to your translation Script as described below.
A typical gmStudio translation is directed by several things:
- Your source code
- The gmPL and gmSL commands in rule files and scripts that you integrate with your upgrade solution
- The system metalanguage files that define VB6/ASP language elements
- The system gmSL scripts that provide common dynamic processing
- The logic in the gmBasic executable
The system metalanguage files and gmSL scripts are typically pre-compiled into a system metalanguage file, VB7Lang.vbi.
You can see the system metalanguage files on the settings form in gmStudio:
One of system gmSL scripts is authortext.gmsl. This script is processed by the the system metalanguage script. vb7lang.xml:
<gmSL NameSpace="gmSL" Class="AuthorText" Source="AuthorText.gmsl" />
The script contains routines that author "boilerplate" content that cannot be generated from the VB6 source; for example configurations in the csproj file, AssemblyInfo files, resx files, and many other blocks of "boiler plate" text that are added to the translation results.
At the top of Authortext.gmsl you will find two empty routines:
void AddUserReferences() { } void AddUserCompiles() { }
These routines are called by gmBasic when it authors the .NET project file. They may be modified to add custom assembly references and code file references.
One option for doing this is to use a project-specific metalang as described here Custom VB6 Language Replacement.
A less involved option is to add a gmSL block to your translation script for example:
... <gmSL namespace="gmSL" Class="AuthorText" ><[CDATA[[ void AddUserReferences() { Write.Line("<!-- AddUserReferences here -->"); } void AddUserCompiles() { Write.Line("<!-- AddUserCompiles here -->"); } ]]></gmsl> <Compile Project="%SrcPath%" Resx="%ResxFolder%" />
This effectively overrides the default implementation with the one provided. The effect on the csproj file can be seen in this difference report: