What do the $package and $project params contain in a NuGet install.ps1 script?

北城余情 提交于 2019-12-12 07:32:50

问题


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:


In NuGet 2:

  • $project => EnvDTE.Project - which is the Visual Studio object model for a project.
  • $package => NuGet.IPackage - the NuGet package.

In NuGet 3:

  • $project => EnvDTE.Project
  • $package => ScriptPackage

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



来源:https://stackoverflow.com/questions/33809210/what-do-the-package-and-project-params-contain-in-a-nuget-install-ps1-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!