Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimal installation of C# 8 command-line compiler for "dotnet build"

We need to install the new C# 8 command-line compiler on our Jenkins server.

We found the "Build Tools for Visual Studio 2019" package on the Visual Studio Downloads page, but when we select the ".NET Core build tools" workload, it wants to install almost 2GB of stuff. This is a problem, as our Jenkins VM has limited disk space.

I've looked through the "Individual components" list, but nowhere do I see anything for "C# 8 command-line compiler". The closest seems to be "Development activities > C# and Visual Basic", but its tooltip says it installs the full IDE and debugger, which we don't need on a build server.

We already have .NET Core 2.0 installed.

What is the minimal set of components we need to install to get the C# 8 compiler installed and working with dotnet build and dotnet test?

like image 286
Joe White Avatar asked Apr 05 '19 19:04

Joe White


1 Answers

If you don't need Visual Studio features during the build - such as building WPF applications, EF .edmx files, test projects using Microsoft Fakes etc, you can use the .NET Core SDK.

You will need to install SDKs with version 2.2.2xx+, 2.1.6xx+ or a 3.0.0.1xx+ preview.

This will allow you to build projects using 8.0 features as long as you set the LangVersion property to preview or 8.0

<PropertyGroup>
  <LangVersion>preview</LangVersion>
</PropertyGroup>
like image 127
Martin Ullrich Avatar answered Oct 05 '22 20:10

Martin Ullrich