简体   繁体   English

在安装包中添加自定义参数

[英]adding custom parameter to install-package

I am building a nuget package which uses an install.ps1 script in the tools folder. 我正在构建一个在工具文件夹中使用install.ps1脚本的nuget软件包。 I want to pass parameters into this install script in the install-package command. 我想在install-package命令中将参数传递到此安装脚本中。

So running in package manger inside visual studio 因此,在Visual Studio中在程序包管理器中运行

install-package mypackage -myparam param 安装软件包mypackage -myparam param

param would then be passed into the install.ps1 file inside the tools folder. 然后将参数传递到tools文件夹内的install.ps1文件。

Is this possible? 这可能吗? Is there a better way to accomplish this? 有没有更好的方法可以做到这一点?

AFAIK that's not possible. 无法使用AFAIK。 The Install-Package cmdlet exposes a few options which map to properties on the InstallPackageCommand in the NuGet sources. Install-Package cmdlet公开了一些选项,这些选项映射到NuGet源代码中InstallPackageCommand上的属性。 You could maybe log an issue or submit a pull request for this kind of functionality? 您可能会记录问题或针对这种功能提交拉取请求?

Instead of trying to extend the Install-Package cmdlet, why not create your own cmdlets and expose that one after installation (similar to MVC scaffolding package)? 为何不尝试扩展Install-Package cmdlet,为什么不创建自己的cmdlet并在安装后公开该cmdlet(类似于MVC脚手架包)?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM