Skip to content

Microsoft.PowerShjell.Commands.Management.dll missing from ref assemblies in SDK #16141

Closed

Description

Prerequisites

Steps to reproduce

When referencing the PowerShell SDK nuget package and trying to use the type Microsoft.PowerShell.Commands.ResolvePathCommand, the assembly is not found.

The ref directory is missing Microsoft.PowerShell.Commands.Management.dll, where the type is implemented.

    Directory: C:\Users\Staffan\.nuget\packages\microsoft.powershell.sdk\7.2.0-preview.9\ref\net6.0

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          2021-08-18    20:51         134656 Microsoft.PowerShell.Commands.Utility.dll
-a---          2021-08-18    19:41         576648 Microsoft.PowerShell.Commands.Utility.xml
-a---          2021-08-18    20:51           7168 Microsoft.PowerShell.ConsoleHost.dll
-a---          2021-08-18    19:41         166674 Microsoft.PowerShell.ConsoleHost.xml
-a---          2021-08-18    20:51         397312 System.Management.Automation.dll
-a---          2021-08-18    19:41        7651228 System.Management.Automation.xml

The same is true for the ref folder of the Microsoft.PowerShell.Commands.Management nuget package.

    Directory: C:\Users\Staffan\.nuget\packages\microsoft.powershell.commands.management\7.2.0-preview.9\ref\net6.0

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---          2021-08-18    20:51         397312 System.Management.Automation.dll
-a---          2021-08-18    19:41        7651228 System.Management.Automation.xml

Expected behavior

Should be able to reference the SDK and use types from Microsoft.PowerShell.Commands.Management.

Actual behavior

Build error.

Error details

error CS0246: The type or namespace name 'ResolvePathCommand' could not be found (are you missing a using directive or an assembly reference?)


### Environment data

```powershell
Referenced the 7.2.0-preview9 SDK.

Visuals

No response

Activity

  1. powercode commented on Sep 23, 2021

    @powercode
    CollaboratorAuthor

    The code used to provoke the error is:

        var iss = InitialSessionState.CreateDefault2();
        iss.Commands.Add(new SessionStateCmdletEntry("Resolve-Path", typeof(Microsoft.PowerShell.Commands.ResolvePathCommand), null));

    The package reference:

    <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.0-preview.9" />
  2. added
    WG-DevEx-SDKhosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules
    on Sep 23, 2021
  3. adityapatwardhan commented on Apr 18, 2023

    @adityapatwardhan
    Member

    Staffan Gustafsson (@powercode) - I have verified the issue with the latest release v7.4.0-preview.2 and it is fixed. Please re-open if you still see the issue.

    Fixed by #19302

  4. ghost removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    WG-DevEx-SDKhosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions