Skip to content

Requires .net 7; does it really need to? #226

@tig

Description

@tig

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

When running my CI scripts for F7History I'm getting

image

Import-Module: D:\a\_temp\bc1451cf-be26-4c21-a8ab-69d5323c81e0.ps1:7
Line |
   7 |  Import-Module Microsoft.PowerShell.ConsoleGuiTools -Verbose -Force
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral,
     | PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Error: Process completed with exit code 1.

This is because the current GitHub Action Runners are still using PowerShell 7.2 (which was built using .net 6 and ConsoleGuiTools is built with .net 7.

{
    "sdk": {
        "version": "7.0.401"
    }
}
<Project Sdk="Microsoft.NET.Sdk">
    <Import Project="..\..\GraphicalTools.Common.props" />
    <PropertyGroup>
        <TargetFramework>net7.0</TargetFramework>
    </PropertyGroup>

etc...

I did this here:

4714dd4

After pulling the remainder of my hair out I figured the cause out and developed a workaround, which installs pwsh 7.3 in my GitHub Action runners. There's probably an easier way to make shell: pwsh use a newer version, but using dotnet tool install works cross platform.

    - name: HACK - Install Latest PowerShell (so we get v7.3+ that uses .net 7)
      shell: pwsh
      run: |
          dotnet tool install --global PowerShell
          $prependText = $HOME + "/.dotnet/tools"
          $filePath = $env:GITHUB_PATH
          $content = Get-Content -Path $filePath
          $newContent = $prependText + "`r`n" + $content
          $newContent | Set-Content -Path $filePath -Encoding utf8
          $newContent

This is a minor issue that will resolve itself once the GitHub runners are updated to use Powershell 7.3.x.

I've submitted an issue for GitHub Runners: actions/runner-images#8754

Expected behavior

ConsoleGuiTools works on PS 7.2.x.

Actual behavior

ConsoleGuiTools fails on 7.2.x

Error details

No response

Environment data

na

Version

7.3.9

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions