Table of Contents

Using AlterNET UI NuGet Packages

The easiest way to create an AlterNET UI application project is to use the project templates that come with AlterNET UI Visual Studio extension or can be installed separately using command line.

However, AlterNET UI Nuget Packages can be referenced manually in a .NET project. To reference AlterNET UI framework in your project, add the following lines to your .csproj file:

<ItemGroup>
    <PackageReference Include="Alternet.UI" Version="0.9.200-beta" />
</ItemGroup>

The Version value can be set to one of the published versions of the AlterNET UI packages.

After you have added the packages, you can start a GUI application in your code. You can use the following code to show an empty window in a .NET console application:

class Program
{
    [STAThread]
    public static void Main(string[] args)
    {
        var application = new Alternet.UI.Application();
        var window = new Alternet.UI.Window();

        application.Run(window);

        window.Dispose();
        application.Dispose();
    }
}

If you would like to hide the console created by the console application, change its OutputType to WinExe like so:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
  </PropertyGroup>