0

So I have view this link: How to reference System.Management.Automation in a .NET Framework 4.7.2?

"you must use System.Management.Automation v5.1.x." this could works for me

But I want to find out if I can use System.Management.Automation without install any reference using Nuget. (like from the native machine, add reference is fine.)

I try to find through assembly but nothing. I have verified that there exist System.Management.Automation.dll in all these three location:

C:\Windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35
C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0
C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0

Also, since I can fine the dll file, so I followed this link (https://learn.microsoft.com/en-us/dotnet/framework/app-domains/install-assembly-into-gac) to install an assembly into the global assembly cache. But still not work.

Only System.Management and System.Management.Instrumentation in (Assemblies) Add Reference table.

Please help,

Many thanks!

  • @ Avenger_Shadow. What method did you use to add Microsoft.PowerShell.5.ReferenceAssemblies? Did you use the command Install-Package Microsoft.PowerShell.5.ReferenceAssemblies -Version 1.1.0 here to download dependencies in visual studio? Could you try this download method (right click on the .Net Framework project and select Manage Nuget Packages...->Search and download Microsoft.Powershell.5.ReferenceAssemblies) to check if the problem can be solved? – Hui Liu-MSFT Jun 17 '21 at 06:14
  • Thanks for reply, Yes this can be resolved by download that. I'm using System.Management.Automation. – Avenger_Shadow Jun 17 '21 at 12:20
  • @ Avenger_Shadow. I have updated the comment to the answer. If it is solved your problem, you can click ‘✔’ to accept it as an answer. It is helpful for community members to solve the similar problems. – Hui Liu-MSFT Jun 18 '21 at 09:33

1 Answers1

2

For downloading Microsoft.PowerShell.5.ReferenceAssemblies in visual studio, you could try this download method (right click on the .Net Framework project and select Manage Nuget Packages...->Search and download Microsoft.Powershell.5.ReferenceAssemblies) to check if the problem can be solved.

Hui Liu-MSFT
  • 770
  • 4
  • 15
  • Thanks for your answer, yes, I know how to download that using Nuget in Visual Studio, I'm trying to find a way NOT using that. The System.Management.Automation.dll is already there as I mentioned, I'm not too sure which package to include though. – Avenger_Shadow Jun 18 '21 at 09:52