Skip to main content

Visual Studio Template Installation

Normally, the gSharp setup application installs the Visual Studio templates required for developing a gSharp calculation assembly. However, in some situations this may fail, requiring manual installation.

Template Installer​

For manual installation of the gSharp Visual Studio developer templates, use the gSharp Template Installer:
Run GSharp.Template.Installer.exe, located in the installation folder you specified during gSharp setup—typically:

C:\Program Files\gHost Technology\gSharp

Developer Templates Page

The installer displays the three most recent Visual Studio versions it detects. Check the versions you want to install the templates for, then click the Install button.

The installer installs each set of selected templates for all instances of Visual Studio displayed. Progress is shown during the process and ends with the final status message:

The gSharp developer template installer at completion

Once installed, the templates will appear in Visual Studio when creating a new project:

The gSharp developer templates displayed in the Visual Studio Create a New Project dialog

Template Installer Errors​

If errors occur during installation, the installer will display them. These are usually due to insufficient permissions to write to the destination folder.

The gSharp developer template installer showing errors

The main gSharp installer may also have indicated that there was a template installation error after installation.

The gSharp installer showing template installation errors

Controlled Folder Access​

One common reason for developer template installation errors is Controlled Folder Access (CFA), a feature in Windows Defender that silently blocks write access to protected folders for untrusted applications. Exactly what constitutes an untrusted application depends on many factors, some of which are known only to Windows Defender. The user's Documents folder is often affected, which is where Visual Studio templates are installed.

There are several ways to work around this:

  1. Temporarily disable CFA
    If CFA isn't enforced via group policy, you can turn it off temporarily:

    • Go to Settings → Privacy & Security → Windows Security → Virus & Threat Protection
    • Scroll down to Ransomware Protection and click Manage ransomware protection
    • Toggle Controlled Folder Access off
    • Run the template installer
    • Toggle Controlled Folder Access back on
  2. Allow the installer through CFA
    If CFA is enforced via group policy:

    • Navigate to Manage ransomware protection (as above)
    • Click Allow an app through Controlled Folder Access
    • Add GSharp.Template.Installer.exe to the allowed list
  3. Manually copy template files
    If the above solutions fail, you can manually copy the template files (because Windows Explorer is a trusted application):

    1. Before closing the template installer, go to:

      %Temp%\GSharp.Templates\Templates

      This is the temporary staging folder for template files.

    2. Copy the contents of the ItemTemplates folder to the corresponding Visual Studio folder.
      For example, for Visual Studio 2022:

      %Temp%\GSharp.Templates\Templates\ItemTemplates
      → Documents\Visual Studio 2022\Templates\ItemTemplates
    3. Repeat for the ProjectTemplates folder:

      %Temp%\GSharp.Templates\Templates\ProjectTemplates
      → Documents\Visual Studio 2022\Templates\ProjectTemplates
    4. Once finished, close the template installer to automatically delete the %Temp%\GSharp.Templates folder.

Important

These workarounds assume that the gSharp installer has already been run with the Developer Kit option selected. This option configures the environment required for the templates to function correctly.

Do not simply copy the template installer to another machine and expect it to work—if the Developer Kit has not been installed by the gSharp installer, the necessary setup steps will be missing.