You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TestPathCommand and several others removed in PowerShell 7.2 SDK #16862
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'
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
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
I believe to fix it we need to the missing assemblies to the $supportedRefList array to this block of code:
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:
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.
// See https://aka.ms/new-console-template for more informationusingSystem.Management.Automation.Runspaces;Console.WriteLine("Hello, World!");variss=InitialSessionState.CreateDefault2();iss.Commands.Add(newSessionStateCmdletEntry("Resolve-Path",typeof(Microsoft.PowerShell.Commands.ResolvePathCommand),null));
Patrick Meinecke (@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.
Darren Kattan (@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?
Darren Kattan (@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?
Darren Kattan (@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.
The was fixed by #19302 and should be available on the latest versions of v7.2, v7.3 and v7.4.0-preview.X
Please re-open if you still see the issue.
Nuget package microsoft.powershell.sdk 7.3.4 is including refs to 7.3.3 causing my project to not build
This appears to be fixed in 7.4.0-preview.3 but we aren't on .net 8 yet, can we get this backported?
Turns out the version mismatch was not actually causing a problem.
The full error was a BadImageFormatException from ReinforcedTypings
Reinforced.Typings : Assembly loading warning RT0014: Assembly Microsoft.PowerShell.Commands.Utility (from C:\Users\DKattan\.nuget\packages\microsoft.powershell.sdk\7.3.4\ref\net7.0\Microsoft.PowerShell.Commands.Utility.dll) failed to load: System.BadImageFormatException: Could not load file or assembly 'Microsoft.PowerShell.Commands.Utility, Version=7.3.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Reference assemblies cannot be loaded for execution. (0x80131058)
Reinforced.Typings : Unexpected error RT0999: Could not load file or assembly 'Microsoft.PowerShell.Commands.Utility, Version=7.3.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
This was not preventing the build from working, simply preventing our TypeScript from being generated post build.
I believe this would have actually been an error in 7.4 had I actually upgraded our project.
ReinforcedTypings has some known issues with reference packages but I was able to workaround it by adding Microsoft.PowerShell.Commands.Utility and System.Management.Automation nuget packages to the project containing Reinforced Typings, generating path property to them and then referencing that in the ReinforcedTypings.Config.xml so it could find the unix/win (non-reference) assembly.
Activity
colinblaise commentedon Feb 9, 2022
Related - #16141
dkattan commentedon 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 commentedon Dec 5, 2022
Patrick Meinecke (@SeeminglyScience) Aditya Mandaleeka (@adityamandaleeka) Travis Plunk (@TravisEz13)
There are 2 problems:
Personally, I don't really care about 2 because I only needed it due to the missing reference in Microsoft.PowerShell.SDK
Problem 1
I believe to fix it we need to the missing assemblies to the $supportedRefList array to this block of code:
PowerShell/tools/packaging/packaging.psm1
Lines 2265 to 2267 in 07175ae
and also to
PowerShell/tools/packaging/packaging.psm1
Lines 2456 to 2460 in 07175ae
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
After
adityapatwardhan commentedon Dec 6, 2022
Darren Kattan (@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 commentedon Dec 9, 2022
TestPowerShell73Dependency2.zip
csproj
Program.cs
dkattan commentedon Dec 21, 2022
Patrick Meinecke (@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.
dkattan commentedon Jan 23, 2023
Hey Aditya Patwardhan (@adityapatwardhan) Any update on this?
bironeaj commentedon Jan 23, 2023
Aditya Patwardhan (@adityapatwardhan) we are having this issue too. Any update?
adityapatwardhan commentedon Jan 23, 2023
This issue is not fixed yet. I am working on it and hopefully will be done soon. Thank you for your patience.
bretesq commentedon Jan 24, 2023
Aditya Patwardhan (@adityapatwardhan) We are also seeing this issue. Any luck with a timeline on this?
dkattan commentedon Jan 24, 2023
Still an issue on 7.3.2, SDK is unusable
Patrick Meinecke (@SeeminglyScience) Aditya Patwardhan (@adityapatwardhan) Andy Jordan (@andschwa)
dkattan commentedon Jan 25, 2023
Aditya Patwardhan (@adityapatwardhan) Can you look at my merge request and perhaps test it since you have access to the required DevOps environment? #19033
adityapatwardhan commentedon Mar 9, 2023
This PR should fix the problem: #19302
We plan to release the next PowerShell Preview with this change.
dkattan commentedon Mar 10, 2023
Yaaass. While you’re in there, any love for SourceLink or Debug symbols? 🥺
adityapatwardhan commentedon Mar 13, 2023
Not right now at least. But maybe in a separate PR.
dkattan commentedon Mar 13, 2023
Like perhaps this one you created 5 years ago?
#8184
adityapatwardhan commentedon Mar 14, 2023
Darren Kattan (@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 commentedon Mar 15, 2023
I'm trying but I'm not yet seeing it in nuget.
dkattan commentedon Mar 16, 2023
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:
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.
adityapatwardhan commentedon Apr 18, 2023
The was fixed by #19302 and should be available on the latest versions of v7.2, v7.3 and v7.4.0-preview.X
Please re-open if you still see the issue.
dkattan commentedon Jun 15, 2023
Nuget package microsoft.powershell.sdk 7.3.4 is including refs to 7.3.3 causing my project to not build
This appears to be fixed in 7.4.0-preview.3 but we aren't on .net 8 yet, can we get this backported?
dkattan commentedon Jun 15, 2023
Turns out the version mismatch was not actually causing a problem.
The full error was a BadImageFormatException from ReinforcedTypings
This was not preventing the build from working, simply preventing our TypeScript from being generated post build.
I believe this would have actually been an error in 7.4 had I actually upgraded our project.
ReinforcedTypings has some known issues with reference packages but I was able to workaround it by adding Microsoft.PowerShell.Commands.Utility and System.Management.Automation nuget packages to the project containing Reinforced Typings, generating path property to them and then referencing that in the ReinforcedTypings.Config.xml so it could find the unix/win (non-reference) assembly.
No action necessary.