X Tutup
The Wayback Machine - https://web.archive.org/web/20230406083102/https://github.com/PowerShell/PowerShell/issues/16862
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestPathCommand and several others removed in PowerShell 7.2 SDK #16862

Open
5 tasks done
colinblaise opened this issue Feb 9, 2022 · 19 comments
Open
5 tasks done

TestPathCommand and several others removed in PowerShell 7.2 SDK #16862

colinblaise opened this issue Feb 9, 2022 · 19 comments
Assignees
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. WG-DevEx-SDK hosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules

Comments

@colinblaise
Copy link

Prerequisites

Steps to reproduce

Using C# SDK, I updated Microsoft.PowerShell.Commands.Management from 7.1.5 to 7.2.1.

The SDK no longer has references to the following commands:

  1. JoinPathCommand
  2. TestPathCommand
  3. GetChildItemCommand
  4. GetItemCommand
  5. SetItemCommand

If this was intentional, how should I be referencing these commands?

Expected behavior

I need to import the commands listed under steps to reproduce

Actual behavior

I can now longer use the commands listed under steps to reproduce

Error details

No response

Environment data

Key                       Value
---                       -----
PSVersion                 7.2.1
PSEdition                 Core
GitCommitId               7.2.1
OS                        Linux 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021
Platform                  Unix
PSCompatibleVersions      {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion      1.1.0.1
WSManStackVersion         3.0

Visuals

No response

@colinblaise colinblaise added the Needs-Triage The issue is new and needs to be triaged by a work group. label Feb 9, 2022
@iSazonov iSazonov added the WG-DevEx-SDK hosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules label Feb 9, 2022
@colinblaise
Copy link
Author

Related - #16141

@dkattan
Copy link

dkattan commented Mar 7, 2022

Further, if you try to include Microsoft.PowerShell.Commands.Management from NuGet you get the error:

Assembly 'Microsoft.PowerShell.Commands.Management' with identity 'Microsoft.PowerShell.Commands.Management, Version=7.3.0.2, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Management.Automation, Version=7.3.0.2, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Management.Automation' with identity 'System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

@dkattan
Copy link

dkattan commented Dec 5, 2022

@SeeminglyScience @adityamandaleeka @TravisEz13

There are 2 problems:

  1. Microsoft.PowerShell.SDK is missing an assembly reference to Microsoft.PowerShell.Commands.Management.dll, Microsoft.PowerShell.Commands.Diagnostics, Microsoft.PowerShell.Security, and Microsoft.WSMan.Management
  2. Microsoft.PowerShell.Commands.Management references System.Management.Automation.dll 7.3.0.500 while Microsoft.PowerShell.SDK references 7.3.0.0

Personally, I don't really care about 2 because I only needed it due to the missing reference in Microsoft.PowerShell.SDK

Problem 1

image

image

I believe to fix it we need to the missing assemblies to the $supportedRefList array to this block of code:

$supportedRefList = @(
"Microsoft.PowerShell.Commands.Utility",
"Microsoft.PowerShell.ConsoleHost")

and also to

$assemblyNames = @(
"System.Management.Automation",
"Microsoft.PowerShell.Commands.Utility",
"Microsoft.PowerShell.ConsoleHost"
)

Problem 2

If you are interested in also fixing the mismatch in problem 2, if you add a hintpath you can get Visual Studio to tell you more information about the issue:

Before

<ItemGroup>
    <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.5" />
    <PackageReference Include="Microsoft.PowerShell.Commands.Management" Version="7.1.5"/>
</ItemGroup>

After

<ItemGroup>
    <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.5" />
    <PackageReference Include="Microsoft.PowerShell.Commands.Management" Version="7.1.5">
      <GeneratePathProperty>True</GeneratePathProperty>
    </PackageReference>
  </ItemGroup>

  <ItemGroup>
    <Reference Include="Microsoft.PowerShell.Commands.Management"> 
<HintPath>$(PkgMicrosoft_powershell_commands_management)\runtimes\unix\lib\net6.0\Microsoft.PowerShell.Commands.Management.dll</HintPath>
    </Reference>
  </ItemGroup>
Found conflicts between different versions of "System.Management.Automation" that could not be resolved.
There was a conflict between "System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.Management.Automation, Version=7.3.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
    "System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "System.Management.Automation, Version=7.3.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
    References which depend on "System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Users\DKattan.IN\.nuget\packages\system.management.automation\7.3.0\ref\net7.0\System.Management.Automation.dll].
        C:\Users\DKattan.IN\.nuget\packages\system.management.automation\7.3.0\ref\net7.0\System.Management.Automation.dll
          Project file item includes which caused reference "C:\Users\DKattan.IN\.nuget\packages\system.management.automation\7.3.0\ref\net7.0\System.Management.Automation.dll".
            C:\Users\DKattan.IN\.nuget\packages\system.management.automation\7.3.0\ref\net7.0\System.Management.Automation.dll
    References which depend on "System.Management.Automation, Version=7.3.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
        C:\Users\DKattan.IN\.nuget\packages\microsoft.powershell.commands.management\7.3.0\runtimes\unix\lib\net7.0\Microsoft.PowerShell.Commands.Management.dll
          Project file item includes which caused reference "C:\Users\DKattan.IN\.nuget\packages\microsoft.powershell.commands.management\7.3.0\runtimes\unix\lib\net7.0\Microsoft.PowerShell.Commands.Management.dll".
            Microsoft.PowerShell.Commands.Management
1>CSC : error CS1705: Assembly 'Microsoft.PowerShell.Commands.Management' with identity 'Microsoft.PowerShell.Commands.Management, Version=7.3.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'System.Management.Automation, Version=7.3.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Management.Automation' with identity 'System.Management.Automation, Version=7.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
1>Done building project "TestPowerShell73Dependency2.csproj" -- FAILED.

@adityapatwardhan
Copy link
Member

@dkattan Could you please provide the full csproj? I would like to see the target framework.

If targeting NET6 -> use Microsoft.Powershell.SDK v 7.2.7
If targeting NET7 -> use Microsoft.Powershell.SDK v 7.3.0

v7.1.x is out of support and should not be used. Also, v7.0.x is out of support.

@dkattan
Copy link

dkattan commented Dec 9, 2022

@dkattan Could you please provide the full csproj? I would like to see the target framework.

If targeting NET6 -> use Microsoft.Powershell.SDK v 7.2.7 If targeting NET7 -> use Microsoft.Powershell.SDK v 7.3.0

v7.1.x is out of support and should not be used. Also, v7.0.x is out of support.

TestPowerShell73Dependency2.zip

csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.PowerShell.SDK" Version="7.3.0" />
  </ItemGroup>

</Project>

Program.cs

// See https://aka.ms/new-console-template for more information
using System.Management.Automation.Runspaces;

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

image

@dkattan
Copy link

dkattan commented Dec 21, 2022

@SeeminglyScience I saw some work done in #18782 v7.4.0-preview.1 related to nuget packages, any chance we can get some traction on this? I just updated my test project to Microsoft.PowerShell.SDK v7.4.0-preview.1 and the problem persists.

@adityapatwardhan adityapatwardhan self-assigned this Jan 4, 2023
@dkattan
Copy link

dkattan commented Jan 23, 2023

Hey @adityapatwardhan Any update on this?

@bironeaj
Copy link

@adityapatwardhan we are having this issue too. Any update?

@adityapatwardhan
Copy link
Member

This issue is not fixed yet. I am working on it and hopefully will be done soon. Thank you for your patience.

@bretesq
Copy link

bretesq commented Jan 24, 2023

@adityapatwardhan We are also seeing this issue. Any luck with a timeline on this?

@dkattan
Copy link

dkattan commented Jan 24, 2023

Still an issue on 7.3.2, SDK is unusable

image

image

@SeeminglyScience @adityapatwardhan @andschwa

@dkattan dkattan mentioned this issue Jan 25, 2023
22 tasks
@msftbot msftbot bot added the In-PR Indicates that a PR is out for the issue label Jan 25, 2023
@dkattan
Copy link

dkattan commented Jan 25, 2023

@adityapatwardhan Can you look at my merge request and perhaps test it since you have access to the required DevOps environment? #19033

@adityapatwardhan
Copy link
Member

This PR should fix the problem: #19302

We plan to release the next PowerShell Preview with this change.

@dkattan
Copy link

dkattan commented Mar 10, 2023

This PR should fix the problem: #19302

We plan to release the next PowerShell Preview with this change.

Yaaass. While you’re in there, any love for SourceLink or Debug symbols? 🥺

@adityapatwardhan
Copy link
Member

Not right now at least. But maybe in a separate PR.

@dkattan
Copy link

dkattan commented Mar 13, 2023

Not right now at least. But maybe in a separate PR.

Like perhaps this one you created 5 years ago?

#8184

@msftbot msftbot bot removed the In-PR Indicates that a PR is out for the issue label Mar 14, 2023
@adityapatwardhan
Copy link
Member

@dkattan The Microsoft.PowerShell.SDK version v7.4.0-preview.2 will be available on NuGet.org in sometime. Could you please help validate that your scenario is fixed by that?

@dkattan
Copy link

dkattan commented Mar 15, 2023

@dkattan The Microsoft.PowerShell.SDK version v7.4.0-preview.2 will be available on NuGet.org in sometime. Could you please help validate that your scenario is fixed by that?

I'm trying but I'm not yet seeing it in nuget.

@dkattan
Copy link

dkattan commented Mar 16, 2023

@dkattan The Microsoft.PowerShell.SDK version v7.4.0-preview.2 will be available on NuGet.org in sometime. Could you please help validate that your scenario is fixed by that?

I'm trying but I'm not yet seeing it in nuget.

I found it, I didn't have the Include Prerelease box checked.

Evidently it requires .NET 8 which requires Visual Studio 2022 17.6 Preview. Got all that installed.

When I attempt to install Microsoft.PowerShell.SDK or Microsoft.PowerShell.Commands.Utility I get:

Severity	Code	Description	Project	File	Line	Suppression State
Error	NU1102	Unable to find package Microsoft.CodeAnalysis.CSharp with version (>= 4.6.0-2.23152.6)
  - Found 142 version(s) in nuget.org [ Nearest version: 4.6.0-1.final ]
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages	TestPowerShell73Dependency2	C:\Users\DKattan\source\repos\TestPowerShell73Dependency2\TestPowerShell73Dependency2\TestPowerShell73Dependency2.csproj	1	

System.Management.Automation, Microsoft.PowerShell.Commands.Diagnostics and Microsoft.PowerShell.Commands.Management install fine.

Installing Microsoft.PowerShell.Commands.Management 7.4.0-preview.2 does solve the problem for TestPathCommand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group. WG-DevEx-SDK hosting PowerShell as a runtime, PowerShell's APIs, PowerShell Standard, or development of modules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
X Tutup