10000 Could not load file or assembly 'System.Management.Automation' after update to .NET 7 · Issue #19078 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content
Could not load file or assembly 'System.Management.Automation' after update to .NET 7 #19078
@KJoreth

Description

@KJoreth

Prerequisites

Steps to reproduce

After updating our project to .NET 7, we are unable to run any of our tests via Windows PowerShell using NUnitConsole 3.16.x

Running the same tests with dotnet test works just fine.

Scripts are run on PowerShell 5.1.19041.1237 and Windows 10 (build 19043.1288). We did try to use the newest version of PS as well but without any success.

Removing reference to Microsoft.PowerShell.SDK from the project allows us to run tests via NUnitConsole, however we don't have any idea why is that the case.

NuGet packages in output project which may have some influence:

"Microsoft.NET.Test.Sdk" Version="17.4.1"
"Moq" Version="4.18.4"
"MSTest.TestAdapter" Version="3.0.2"
"MSTest.TestFramework" Version="3.0.2"
"NUnit3TestAdapter" Version="4.3.1"
"Microsoft.PowerShell.SDK" Version="7.3.1"

Expected behavior

Running `.\nunit3-console.exe("tests.dll")` command in PowerShell should start our tests.

Actual behavior

We get an error:

Unable to load one or more of the requested types.
Could not load file or assembly 'System.Management.Automation, Version=7.3.1.0

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1237
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1237
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0