14

I'm writing my first install PowerShell script for a NuGet package. I'm trying to copy a file from the lib folder into the tools folder of another NuGet package. The default install.ps1 script has four parameters, two of which are:

  • $package
  • $project

They appear to be "objects" of some sort, but I'm not sure what properties and methods they contain. I've done some searching online, but have yet to find a reference or any documentation for these arguments.

Looking at this StackOverflow post, the question contains a link to Project Interface. Is that what $project is in the NuGet install.ps1 file?

1 Answer 1

13

In NuGet 2:

In NuGet 3:

Note that the $package in NuGet 3 has a fewer properties available so some PowerShell scripts included with existing NuGet packages will not work.

You can always see which .NET Type a PowerShell variable is by using GetType().FullName, e.g.:

Write-Output $project.GetType().FullName
Write-Output $package.GetType().FullName
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.