There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull
example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty
.
string? hello = "hello world";
There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull
example requires it.
Consider adopting the new property pattern, wherever you use IsNullOrEmpty
.
string? hello = "hello world";
The following intructions can be used to install .NET Core on Linux ARM64.
Pro tip: Check out .NET Core Docker files to determine the exact instructions for installing .NET Core builds, for example .NET Core 3.1 ARM32 SDK Dockerfile.
The following instructions install the latest .NET Core globally. It isn't required to do that, but it provides the best experience.
FROM microsoft/dotnet-framework:4.7.2-sdk AS build | |
WORKDIR /app | |
# copy csproj and restore as distinct layers | |
COPY *.sln . | |
COPY aspnetapp/*.csproj ./aspnetapp/ | |
COPY aspnetapp/*.config ./aspnetapp/ | |
RUN nuget restore | |
# copy everything else and build app |
The following are examples of various features.
FROM alpine | |
ARG TARGETPLATFORM | |
ARG TARGETOS | |
ARG TARGETARCH | |
ARG TARGETVARIANT | |
ARG BUILDPLATFORM | |
ARG BUILDOS | |
ARG BUILDARCH | |
ARG BUILDVARIANT |
using System; | |
using System.Net.Http; | |
using System.Net.Http.Json; | |
string serviceURL = "https://localhost:5001/WeatherForecast"; | |
HttpClient client = new(); | |
Forecast[] forecasts = await client.GetFromJsonAsync<Forecast[]>(serviceURL); | |
foreach(Forecast forecast in forecasts) | |
{ |
<ProjectSdk="Microsoft.NET.Sdk.WindowsDesktop"> | |
<PropertyGroup> | |
<OutputType>WinExe</OutputType> | |
<TargetFramework>netcoreapp3.0</TargetFramework> | |
<UseWindowsForms>true</UseWindowsForms> | |
</PropertyGroup> | |
</Project> |
This workflow explores the 3.0
manifest-based tag in the mcr.microsoft.com/v2/dotnet/core/runtime repo on MCR as an example. It uses curl
to call a set of container registry APIs to find image digests, layer digests, and layer location. This example is intended to show the separation between MCR as a image manifest service and Azure CDN as an image layer service.
This pattern can be used on any operating system, but the specific commands are OS-specific. curl
is included in the latest versions of Windows and is also in most Linux and macOS distributions. findstr
is part of Windows, however, grep
can be used on Linux or macOS instead.
The 3.0
tag is a manifest tag. It represents a set of potential candidate images, for various operating systems and operating systems versions. When a manifest tag is pulled by a docker client, the client picks the best image for the host op
.NET Core started out life as a cross-platform project. We naturally wanted to encourage usage on Linux. Across the first couple versions, we figured out how to build a single set of binaries that worked everywhere (e.g. for Linux x64). A key design point of that project was building on an old Linux so that our choice of build OS didn’t unnecessarily limit where .NET apps could be run. That has worked well, using CentOS 7, but it will soon go out of support. There isn't an obvious replacement for CentOS 7, requiring us to adopt a new approach.
We intend to use a combination of Mariner and a streamlined copy of Ubuntu going forward.
The primary aspect of breadth targeting on Linux is linking with the C standard library (libc). Native code (like the .NET runtime) is compiled with a given libc and then is only able to run on distros with a libc version at le