以下の内容はhttps://rksoftware.hatenablog.com/entry/2025/06/12/010127より取得しました。


GitHub Copilot が勝手に target framework を変える

どんな場合に勝手に変えてしまうのか。

■ 3 つの issue

issue を 3 つ作って動作を見てみます。

何もしない

何もしない場合は何もしませんでした。

1+1=?

実装して target framework を変えてきました。

数あてゲーム

古より伝わるプログラム練習教材、数あてゲーム。
実装して target framework を変えてきました。

どうも何か手を入れると、target framework も変えるみたいですね。

■ Actions で自動テスト

別のリポジトリですが、Push 時の自動テストでは .NET 10 がインストールされているようです。

Setup .NET とも言っていますし。Build できてテストもパスします。

■ issue へのアサインではどうでしょう?

そう、Setup .NET ありません。

実際ビルドもエラーになっています。

同じ、Actions の中にいますが、Actions の時と、イメージが違うようですね。

■ と思ったら

テストの Actuon では、dotnet-version: 10.0.x を指定していました。

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Setup .NET
      uses: actions/setup-dotnet@v4
      with:
        dotnet-version: 10.0.x
    - name: Restore dependencies
      run: dotnet restore ./src/RKPlugin/TestProject1/
    - name: Build
      run: dotnet build ./src/RKPlugin/TestProject1/ --no-restore
    - name: Test
      run: dotnet test ./src/RKPlugin/TestProject1/ --no-build --verbosity normal

■ devcontainer.json

devcontainer.json で .NET 10 のイメージ使うようにしているのですが、これ Actions の中では意味ないようですね。

{
  "name": ".NET 10 Dev Container",
  "image": "mcr.microsoft.com/devcontainers/dotnet:1.0-10.0",
  "features": {
    "ghcr.io/devcontainers/features/github-cli:1": {},
    "ghcr.io/devcontainers/features/github-codespaces:1": {}
  },
  "forwardPorts": [
    5000,
    5001
  ],
  "remoteUser": "vscode",
  "customizations": {
    "vscode": {
      "extensions": [
        "ms-dotnettools.csharp",
        "ms-dotnettools.csdevkit",
        "GitHub.copilot",
        "EditorConfig.EditorConfig"
      ],
      "settings": {
        "terminal.integrated.shell.linux": "/bin/bash"
      }
    }
  },
  "postCreateCommand": "dotnet --version"
}



以上の内容はhttps://rksoftware.hatenablog.com/entry/2025/06/12/010127より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14