From e176efbc646f5f623ace8aed56a0a2cc09823731 Mon Sep 17 00:00:00 2001 From: Dustin Brewer Date: Sun, 4 Feb 2024 06:03:26 +0000 Subject: [PATCH] Upgrade to dotnet8 --- .devcontainer/Dockerfile | 79 --------------------------------- .devcontainer/devcontainer.json | 26 ++++++----- .github/workflows/main.yml | 2 +- APC/APC.csproj | 6 +-- APCTest/APCTest.csproj | 2 +- Dockerfile | 4 +- apc2mqtt.sln | 31 +++++++++++++ 7 files changed, 53 insertions(+), 97 deletions(-) delete mode 100644 .devcontainer/Dockerfile create mode 100644 apc2mqtt.sln diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index cacf978..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,79 +0,0 @@ -#------------------------------------------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. -#------------------------------------------------------------------------------------------------------------- - -ARG DOTNETCORE_VERSION=7.0 -FROM mcr.microsoft.com/dotnet/sdk:${DOTNETCORE_VERSION} - -# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux, -# this user's GID/UID must match your local user UID/GID to avoid permission issues -# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See -# https://aka.ms/vscode-remote/containers/non-root-user for details. -ARG USERNAME=vscode -ARG USER_UID=1000 -ARG USER_GID=$USER_UID - -# [Optional] Version of Node.js to install. -ARG INSTALL_NODE="false" -ARG NODE_VERSION="lts/*" -ENV NVM_DIR=/home/vscode/.nvm - -# [Optional] Install the Azure CLI -ARG INSTALL_AZURE_CLI="false" - -# Avoid warnings by switching to noninteractive -ENV DEBIAN_FRONTEND=noninteractive - -# Configure apt and install packages -RUN apt-get update \ - && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \ - # - # Verify git, process tools, lsb-release (common in install instructions for CLIs) installed - && apt-get -y install git iproute2 procps apt-transport-https gnupg2 curl lsb-release vim ssh mosquitto mosquitto-clients \ - # - # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. - && groupadd --gid $USER_GID $USERNAME \ - && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ - # [Optional] Add sudo support for the non-root user - && apt-get install -y sudo \ - && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\ - && chmod 0440 /etc/sudoers.d/$USERNAME \ - # - # [Optional] Install Node.js for ASP.NET Core Web Applicationss - && if [ "$INSTALL_NODE" = "true" ]; then \ - # - # Install nvm and Node - mkdir ${NVM_DIR} \ - && curl -so- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash 2>&1 \ - && chown -R vscode:vscode ${NVM_DIR} \ - && /bin/bash -c "source $NVM_DIR/nvm.sh \ - && nvm install ${NODE_VERSION} \ - && nvm alias default ${NODE_VERSION}" 2>&1 \ - && INIT_STRING='[ -s "$NVM_DIR/nvm.sh" ] && \\. "$NVM_DIR/nvm.sh" && [ -s "$NVM_DIR/bash_completion" ] && \\. "$NVM_DIR/bash_completion"' \ - && echo $INIT_STRING >> /home/vscode/.bashrc \ - && echo $INIT_STRING >> /home/vscode/.zshrc \ - && echo $INIT_STRING >> /root/.zshrc \ - # - # Install yarn - && curl -sS https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/pubkey.gpg | apt-key add - 2>/dev/null \ - && echo "deb https://dl.yarnpkg.com/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ - && apt-get update \ - && apt-get -y install --no-install-recommends yarn; \ - fi \ - # - # [Optional] Install the Azure CLI - && if [ "$INSTALL_AZURE_CLI" = "true" ]; then \ - echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \ - && curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \ - && apt-get update \ - && apt-get install -y azure-cli; \ - fi \ - # - # Clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -# Switch back to dialog for any ad-hoc use of apt-get -ENV DEBIAN_FRONTEND= diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9ea9852..60f1863 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,13 +1,17 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": "twomqtt", - "dockerFile": "Dockerfile", - "settings": { - "csharpsortusings.sort.usings.splitGroups": false - }, - "remoteUser": "vscode", - "extensions": [ - "ms-dotnettools.csharp", - "k--kato.docomment", - "jongrant.csharpsortusings" - ] + "name": "C# (.NET)", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0-bookworm", + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-dotnettools.csdevkit" + ] + } + } } \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 811d289..26be385 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v3 with: - dotnet-version: '7.0.x' + dotnet-version: '8.0.x' - name: Build Project run: dotnet build -c Release -o output APC diff --git a/APC/APC.csproj b/APC/APC.csproj index 0a50294..a07ec3e 100644 --- a/APC/APC.csproj +++ b/APC/APC.csproj @@ -1,15 +1,15 @@ - 0.2.$([System.DateTime]::UtcNow.ToString(yy))$([System.DateTime]::UtcNow.DayOfYear.ToString(000)).$([System.DateTime]::UtcNow.ToString(HHmm))$([System.Math]::Floor($([MSBuild]::Divide($([System.DateTime]::UtcNow.Second), 6)))) + 0.3.$([System.DateTime]::UtcNow.ToString(yy))$([System.DateTime]::UtcNow.DayOfYear.ToString(000)).$([System.DateTime]::UtcNow.ToString(HHmm))$([System.Math]::Floor($([MSBuild]::Divide($([System.DateTime]::UtcNow.Second), 6)))) Exe - net7.0 + net8.0 enable $(RestoreSources);../vendor;https://api.nuget.org/v3/index.json - + diff --git a/APCTest/APCTest.csproj b/APCTest/APCTest.csproj index 383f045..e4e5fcc 100644 --- a/APCTest/APCTest.csproj +++ b/APCTest/APCTest.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 false $(RestoreSources);../vendor;https://api.nuget.org/v3/index.json diff --git a/Dockerfile b/Dockerfile index 71aac30..f7da680 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # $BUILDPLATFORM ensures the native build platform is utilized ARG BUILDPLATFORM=linux/amd64 -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0 as build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 as build WORKDIR /src # Only fetch dependencies once # Find the non-test csproj file, move it to the appropriate folder, and restore project deps @@ -12,6 +12,6 @@ COPY . ./ ARG BUILD_VERSION=0.0.0.0 RUN dotnet build -o output -c Release --no-restore -p:Version=$BUILD_VERSION APC -FROM mcr.microsoft.com/dotnet/runtime:7.0 AS runtime +FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime COPY --from=build /src/output app ENTRYPOINT ["dotnet", "./app/APC.dll"] diff --git a/apc2mqtt.sln b/apc2mqtt.sln new file mode 100644 index 0000000..bf400dc --- /dev/null +++ b/apc2mqtt.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.002.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APC", "APC\APC.csproj", "{9C1B55C4-D1BF-4DB4-8315-A69056631A85}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APCTest", "APCTest\APCTest.csproj", "{DDCB5150-05B5-412A-9C59-2AE6542BC1E8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9C1B55C4-D1BF-4DB4-8315-A69056631A85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9C1B55C4-D1BF-4DB4-8315-A69056631A85}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9C1B55C4-D1BF-4DB4-8315-A69056631A85}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9C1B55C4-D1BF-4DB4-8315-A69056631A85}.Release|Any CPU.Build.0 = Release|Any CPU + {DDCB5150-05B5-412A-9C59-2AE6542BC1E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DDCB5150-05B5-412A-9C59-2AE6542BC1E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DDCB5150-05B5-412A-9C59-2AE6542BC1E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DDCB5150-05B5-412A-9C59-2AE6542BC1E8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3A3641D4-BDC7-4C62-B9D5-AE8DA643642D} + EndGlobalSection +EndGlobal