sirzento
sirzento

Reputation: 707

c# nuget package doesn't show up in references in VS

I want to create a C# app that does things with the powershell. I found many solutions on the internet how to do that like this. The most answeres to this use the Powershell class from 'Microsoft.WSMan.Runtime'. Now when I search this package in nuget and install it, it doesnt show up in the references list in visual studio and also the using statement or the 'quick fix' on a PowerShell object doesnt find it.

Did I install something wrong or do I need something else too?


Edit for more infos:

Upvotes: 0

Views: 218

Answers (1)

LoLance
LoLance

Reputation: 28126

I found the assembly within the package targets .net core 3.1 instead of .net framework 4.6.1. So you can't see the reference in solution explorer.

It's by design of the package author, you can download the package manually, rename the name from xx.nupkg to xx.zip to check the content of the package.

The structure of the package:

enter image description here

And the content of the Microsoft.WSMan.Runtime.nuspec file:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata>
    ...
    <dependencies>
      <group targetFramework=".NETCoreApp3.1" />
    </dependencies>
    <contentFiles>
      <files include="**/*" buildAction="None" copyToOutput="true" flatten="false" />
    </contentFiles>
  </metadata>
</package>

Upvotes: 1

Related Questions