diff --git a/base/Dockerfile b/base/Dockerfile index 178561b..cc0ea37 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -17,41 +17,42 @@ USER root ENV \ # Enable detection of running in a container DOTNET_RUNNING_IN_CONTAINER=true \ +# Do not show first run text + DOTNET_NOLOGO=true \ + # SDK version + DOTNET_SDK_VERSION=8.0.100 \ # Enable correct mode for dotnet watch (only mode supported in a container) DOTNET_USE_POLLING_FILE_WATCHER=true \ # Skip extraction of XML docs - generally not useful within an image/container - helps performance NUGET_XMLDOC_MODE=skip \ - # Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id + # Opt out of telemetry until after we install jupyter when building the image, this prevents caching of machine id DOTNET_TRY_CLI_TELEMETRY_OPTOUT=true # Install .NET CLI dependencies RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + && apt-get install -y --no-install-recommends \ curl \ - libc6 \ + libc6 \ libgcc1 \ libgssapi-krb5-2 \ - libicu66 \ - libssl1.1 \ - libstdc++6 \ + libssl3 \ + git \ + libicu70 \ + wget \ + libstdc++6 \ zlib1g \ && rm -rf /var/lib/apt/lists/* # Install .NET Core SDK -# When updating the SDK version, the sha512 value a few lines down must also be updated. -ENV DOTNET_SDK_VERSION 3.1.301 - -RUN dotnet_sdk_version=3.1.301 \ - && curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$dotnet_sdk_version/dotnet-sdk-$dotnet_sdk_version-linux-x64.tar.gz \ - && dotnet_sha512='dd39931df438b8c1561f9a3bdb50f72372e29e5706d3fb4c490692f04a3d55f5acc0b46b8049bc7ea34dedba63c71b4c64c57032740cbea81eef1dce41929b4e' \ - && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ +RUN curl -fSL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \ + && dotnet_sha512='13905ea20191e70baeba50b0e9bbe5f752a7c34587878ee104744f9fb453bfe439994d38969722bdae7f60ee047d75dda8636f3ab62659450e9cd4024f38b2a5' \ + && echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \ && mkdir -p /usr/share/dotnet \ - && tar -ozxf dotnet.tar.gz -C /usr/share/dotnet \ + && tar -oxzf dotnet.tar.gz -C /usr/share/dotnet \ && rm dotnet.tar.gz \ - && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \ - # Trigger first run experience by running arbitrary cmd - && dotnet help + && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \ + && dotnet help # Copy package sources @@ -65,7 +66,7 @@ RUN pip install nteract_on_jupyter # RUN dotnet tool install -g Microsoft.dotnet-interactive --add-source "https://dotnet.myget.org/F/dotnet-try/api/v3/index.json" #latest stable from nuget.org -RUN dotnet tool install -g Microsoft.dotnet-interactive --add-source "https://api.nuget.org/v3/index.json" --version 1.0.148003 +RUN dotnet tool install -g Microsoft.dotnet-interactive --add-source "https://api.nuget.org/v3/index.json" --version 1.0.505402 ENV PATH="${PATH}:${HOME}/.dotnet/tools" RUN echo "$PATH" diff --git a/sessions/Season-08/0803-CommandLine/1-Download.PNG b/sessions/Season-08/0803-CommandLine/1-Download.PNG new file mode 100644 index 0000000..c0ca618 Binary files /dev/null and b/sessions/Season-08/0803-CommandLine/1-Download.PNG differ diff --git a/sessions/Season-08/0803-CommandLine/README.md b/sessions/Season-08/0803-CommandLine/README.md new file mode 100644 index 0000000..6a0df36 --- /dev/null +++ b/sessions/Season-08/0803-CommandLine/README.md @@ -0,0 +1,245 @@ +# 0803 - Command Line Tips and Text-Editors + +.NET and .NET Core have been built to be command-line driven first. Visual Studio and other code tools use the same capabilities to build and interact with your projects as the command-line tools. This means that regardless of which operating system you are using and what tools are available, you can always build and work with .NET code at the command-line. + +The terms .NET Command-line interface (CLI) and Software Development Kit (SDK) are used interchangably to refer to the `dotnet` command and tools that can run on Windows, Mac, or Linux + +## Acquisition and setup + +While we know .NET comes with Visual Studio, installing the command-line tools is easy from https://dot.net/download The website will detect which browser and operating system you're using and recommend an immediate download appropriate for your system. + +![Download screen on dot.net for the .NET command-line tools](1-Download.PNG) + +Other downloads for other operating systems are available. + +### Install on Linux + +Installing on Linux can be performed at the command-line using various package managers and scripts. + +For example, on Ubuntu you can install the .NET 7 version of the SDK using the following command: + +```bash +sudo apt-get update && \ + sudo apt-get install -y dotnet-sdk-7.0 +``` + +Additionally, there is a [Linux install script available](https://learn.microsoft.com/dotnet/core/install/linux-scripted-manual#scripted-install) that will attempt download and install the .NET SDK. + +```bash +wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh +``` + +Set the script to executable: + +```bash +chmod +x ./dotnet-install.sh +``` + +Finally execute the script to install .NET + +```bash +./dotnet-install.sh --version latest +``` + +[Complete and current directions for installing on Linux](https://learn.microsoft.com/dotnet/core/install/linux) are available on Microsoft Learn. + +## Which .NET? + +When downloading the SDK, its important to note that all SDKs are fully backwards compatible. You can optionally specify supported .NET versions to work with older projects. Unless you have a specific reason to support an older project on a framework that is not currently supported, always download the latest version of the SDK. + +You can choose to download a preview version, and know that you can choose which .NET SDK version you are using as they can be run side-by-side on any device. + +For example, you can create a new website and specify a framework version using the .NET 8 SDK with any of the following commands to start a website with a template for the .NET 6, .NET 7, or .NET 8 versions: + +```bash +dotnet new web -f net6.0 +dotnet new web -f net7.0 +dotnet new web -f net8.0 +``` + +## Version control with global.json + +With every version of the .NET tools, you can create a file called `global.json` that will specify which version of the .NET SDK should be used in that folder and all child folders. + +This file contains a minimum version number and directions about which version numbers of the .NET SDK are allowed to be used. + +```json +{ + "sdk": { + "version": "6.0.300", + "rollForward": "latestFeature", + "allowPrerelease": true + } +} +``` + +More information about [global.json](https://learn.microsoft.com/dotnet/core/tools/global-json) and controlling the .NET SDK can be found on Microsoft Learn. + +## Which version do I have installed? + +You can report the current version of the .NET SDK detected and running for the current folder with: + +```bash +dotnet --version +``` + +You can see the complete list of runtimes and tools installed with: + +```bash +dotnet --info +``` + +## General Format of dotnet commands + +The command-line is set up around a basic "action verb noun" syntax. You specify a type of action you would like to take, and then an action with additional descriptors to take with that: + +```bash +dotnet new web +dotnet run +dotnet build +dotnet watch test +dotnet ef database update +``` + +All commands have help text available when the `--help` argument is added. + +All of the commands shown work the same on every operating system for the same version of the .NET SDK. + +## How do I get additional tools to work with .NET MAUI or WASM projects? + +There is an additional set of tools and downloads available that install SDKs and tools to work with iOS, Android, MacOS, and Web Assembly compilers under a feature called `workloads`. + +You can view the list of available workloads using: + +```bash +dotnet workload list +``` + +You can install a workload with Android tools using a command like + +```bash +dotnet workload install android +``` + +## How do I create an application? + +You can generate a new application from a template using: + +```bash +dotnet new