development

Visual Studio에서 system.management.automation.dll 참조

big-blog 2020. 7. 7. 07:16
반응형

Visual Studio에서 system.management.automation.dll 참조


PowerShell 모델 및 스냅인 개발을 살펴보기 시작했습니다. 가장 먼저 눈에 띄는 것은 System.management.automation.dll을 참조하는 것입니다. 그러나 Visual Studio에서 .NET 탭에는 해당 어셈블리가 없으며 탐색 할 수도 없습니다.

C:\windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35\System.Management.Automation.dll

파일 기반 참조를 만들 수 있습니다.

쉽게 참조 할 수 있도록 파일을 수동으로 복사해야 합니까?


Nuget의 System.Management.Automation

NuGet의 System.Management.Automation.dll , 2015 년 이후의 최신 패키지로 이전 패키지로 나열되지 않았습니다!

NuGet Microsoft PowerShell 팀 패키지

업데이트 : 패키지는 이제 PowerShell 팀에서 소유합니다. 후자!


Windows SDK (적절한 최신 버전)를 설치할 때 System.Management.Automation.dll 복사본이 설치됩니다. C : \ Program Files \ Reference Assemblies \ Microsoft \ WindowsPowerShell \ v1.0 \에 있어야합니다.


Windows SDK를 설치하지 않으려면 powershell에서 다음 명령을 실행하여 dll을 얻을 수 있습니다.

Copy ([PSObject].Assembly.Location) C:\

SDK를 제대로 설치하지 못했습니다 (일부 파일은 서명되지 않은 것 같습니다). 나는 여기에 다른 해결책을 찾았고 그것은 나에게 잘 작동하는 것 같다. 새 파일을 설치할 필요가 없습니다. 기본적으로 수행하는 작업은 다음과 같습니다.

텍스트 편집기에서 .csproj 파일을 편집하고 다음을 추가하십시오.

<Reference Include="System.Management.Automation" />

관련 섹션으로.

도움이 되었기를 바랍니다.


64 비트 인 경우-C : \ Program Files (x86) \ Reference Assemblies \ Microsoft \ WindowsPowerShell ** 3.0 **

버전이 다를 수 있습니다


Powershell SDK (C : \ Program Files \ Reference Assemblies \ Microsoft \ WindowsPowerShell \ v1.0)와 함께 제공되는 어셈블리에는 Powershell 2 특정 유형이 제공되지 않습니다.

csproj 파일을 수동으로 편집하면 문제가 해결되었습니다.


VS 프로젝트 참조 메뉴를 사용하여 C : \ windows \ assembly \ GAC_MSIL \ System.Management.Automation으로 이동하여 dll 및 Runspaces dll에 대한 참조를 추가했습니다.

.csprj 파일을 해킹하고 위에서 언급 한 참조 줄을 추가 할 필요가 없었습니다. Windows SDK가 설치되어 있지 않습니다.

위에서 언급 한 Powershell 사본을 수행했습니다. 복사 ([PSObject] .Assembly.Location) C : \

Get-Process Powershell 명령을 사용한 테스트가 작동했습니다. 필자는 개발자를 위해 Powershell의 예제를 사용했습니다 .5 장.


다음과 같이 nuget을 사용할 수도 있습니다. https://www.nuget.org/packages/System.Management.Automation/ 더 나은 옵션 일 수 있습니다.

참고 URL : https://stackoverflow.com/questions/1186270/referencing-system-management-automation-dll-in-visual-studio

반응형