Skip to main content
Version: Next

Install G#

Create and run a G# project with your usual .NET tools. The recommended path uses the published project templates and MSBuild SDK, not a source build of the compiler.

Prerequisites​

Install the .NET 10 SDK for your operating system. The runtime alone is not enough to create and build projects.

Check that the SDK is available:

dotnet --list-sdks

The list should include a 10.0 SDK. If dotnet is not found, finish installing the SDK and open a new terminal.

Start with the project template​

These commands install the published 0.4.591 template and create a console application:

dotnet new install Gsharp.Templates::0.4.591
dotnet new gsharp-console -n MyApp
cd MyApp
dotnet run

Expected output:

Hello from GSharp!

The template pins Gsharp.NET.Sdk in the generated project. Packages restore from the public NuGet feed; you do not need to configure a private feed.

Next: open Program.gs and follow Quickstart: Hello, G#.

:::note Published release or Next? These commands install the published release. Features described only in Next may require a source-built compiler. Use the version selector to read the matching documentation; see Build the compiler from source for development work. :::

Install the VS Code extension​

Install G# from the Visual Studio Marketplace, or run:

code --install-extension gsharplang.vscode-gsharp

Open the project folder in VS Code for highlighting, completion, navigation, diagnostics, and debugging. The code command is optional; you can install the extension through the editor UI instead.

See VS Code setup for configuration and debugging for breakpoints and launch settings.

Troubleshooting the first run​

Symptom Check 
dotnet is not found Install the SDK, then reopen the terminal so it sees the updated PATH. 
No template named gsharp-console Run the template installation command above before creating the project. 
The G# SDK cannot be resolved Check network access to NuGet and the project's NuGet.config. Keep the version generated by the template. 
A compatible runtime is missing Verify the .NET 10 installation; the compiler's runtime requirement is separate from your application's target framework. 
An example uses unfamiliar syntax Check the documentation version and release notes. Do not mix preview examples with an older installed package. 

Author a project by hand​

For an existing source directory, a minimal .gsproj is:

HelloWorld.gsproj
<Project Sdk="Gsharp.NET.Sdk/0.4.591">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
</Project>

The SDK includes .gs files automatically. Use dotnet build and dotnet run as you would with another .NET project. See SDK and project files for references, library projects, packaging, and application target frameworks.

Build the compiler from source​

This is the contributor/preview path, not a prerequisite for using the release:

git clone https://github.com/DavidObando/gsharp.git
cd gsharp
dotnet build GSharp.sln

Then run a checked-in sample:

dotnet src/Compiler/bin/Debug/net10.0/gsc.dll samples/HelloWorld.gs

Without /out, gsc emits and runs the program. Add /out to save an assembly. Read the compiler CLI reference for references, target frameworks, and output options.