Skip to main content

Create a first project

This page summarizes the steps to create and start a first Lagoon application.

Prerequisites​

.NET 8 SDK​

Lagoon targets .NET 8 for current applications. Install the .NET 8 SDK before restoring or building a solution.

lgn global tool​

The lgn global tool, provided by the LGN package, is required for Release builds of the Lagoon.UI* modules. It minifies the JavaScript during precompilation. In Debug configuration, this minification is bypassed and the scripts are only concatenated.

Installation:

dotnet tool install -g LGN

Update:

dotnet tool update -g LGN

Known build error codes:

CodeMeaningAction
9009The lgn tool is not installed.Install LGN with dotnet tool install -g LGN.
7007The lgn tool is outdated.Update LGN with dotnet tool update -g LGN.

Private NuGet feed​

Lagoon applications use a private NuGet feed. In the demo solution, Apps\Demo\NuGet.Config configures:

  • https://api.nuget.org/v3/index.json for general packages;
  • https://nuget.lagoon-toolkit.com/index.json for Lagoon.* and LGN.* packages.

The private feed credentials must be present in the local NuGet configuration. Otherwise, dotnet restore fails when resolving Lagoon packages.

Create the solution​

The creation command is:

lgn new

It launches an interactive wizard and scaffolds a Lagoon solution with the usual application projects, such as Client, Server, Model, Shared, and, as needed, Services or Batch.

The exact options offered by the wizard depend on the tool version. Follow the prompts displayed by lgn new without assuming any undocumented option.

Restore the packages​

From the application solution folder:

dotnet restore

For the demo solution, the restore relies on Apps\Demo\NuGet.Config to resolve public packages and Lagoon packages.

Build the solution​

Build the application solution:

dotnet build

You can also explicitly target a solution, for example:

dotnet build Apps\Demo\Demo.sln

For Release builds of the Lagoon.UI* modules, the lgn tool must be installed and up to date. In Debug, the JS minification step is bypassed.

Run the application​

The web application is hosted by the Server project. So run the server project:

dotnet run --project Apps\Demo\Server\Demo.Server.csproj

The server Program.cs starts the application with LagoonWebApplication.Run<Main>(args). The Main class configures the DbContext, the services, the HTTP pipeline, authentication, and authorization.

Next step​