Skip to main content

.Net Core

The .NET buildpack will automatically be applied as long as your project has one or more of the following:

  • A *.csproj file
  • A *.fsproj file
  • A *.vbproj file
  • The BP_DOTNET_FRAMEWORK_VERSION build argument set

Features

Installing Specific .NET Runtime and ASP.NET Versions

You can set version details in any of the following ways:

Using the BP_DOTNET_FRAMEWORK_VERSION Build Argument
See the BP_DOTNET_FRAMEWORK_VERSION section on this page.

Using a Project File
You can specify the .NET Core Runtime version in any of the following files:

  • *.csproj
  • *.fsproj
  • *.vbproj

Include the following in your project file:

<Project>
<PropertyGroup>
<RuntimeFrameworkVersion>2.1.14</RuntimeFrameworkVersion>
</PropertyGroup>
</Project>

Using runtimeconfig.json
Set the framework version as follows:

{
"runtimeOptions": {
"framework": {
"version": "2.1.14"
}
}
}

Building From a Subdirectory

By default, FL0 will look in the root folder for the .NET project. This directory needs to contain a C#, F# or VB Project file. If your project is located in a subdirectory, you can use the BP_DOTNET_PROJECT_PATH build argument to override the default path.

Configuring the dotnet publish Command

FL0 uses the dotnet publish command with the following default flags:

  • --configuration Release
  • --runtime linux-x64
  • --self-contained false
  • --output <temp-directory>

You can override this behavior using the BP_DOTNET_PUBLISH_FLAGS build argument.

Build Arguments

Build Arguments let you configure how your application is built. There are many options depending on the language-specific buildpack. See the documentation page for more details on how to use Build Arguments.

BP_DOTNET_FRAMEWORK_VERSION

Configure the buildpack to use a certain version of the .NET Core Runtime and ASP.NET.

Example: BP_DOTNET_FRAMEWORK_VERSION=5.0.4

BP_DOTNET_PROJECT_PATH

Configure the buildpack to build from a directory other than the root folder.

Example: BP_DOTNET_PROJECT_PATH=./Path/To/Project

BP_DOTNET_PUBLISH_FLAGS

Override the default flags to be passed to the dotnet publish command

Example: BP_DOTNET_PUBLISH_FLAGS=--verbosity=normal --self-contained=true

Example Template

An example of the ASP.NET Core application can be found in the FL0 templates repository: fl0zone/template-dotnet.