NuGet - install.ps1 不会被调用 [英] NuGet - install.ps1 does not get called

查看:16
本文介绍了NuGet - install.ps1 不会被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建我的第一个 NuGet 包.我不知道为什么我的 install.ps1 脚本没有被调用.这是目录结构

I'm trying to create my first NuGet package. I don't know why my install.ps1 script does not get called. This is directory structure

--Package
|
 - MyPackage.nuspec
 - tools
 |
  - Install.ps1
  - some_xml_file

我使用这个命令行构建包nuget.exe 包 MyPackage.nuspec

I build package using this command line nuget.exe pack MyPackage.nuspec

当我从 VS 包管理器控制台安装包时 install.ps1 不会被调用.

When I Install-Package from VS Package Manager Console install.ps1 does not get called.

我想也许我在脚本中有一些错误,这就是原因,所以我把所有内容都注释掉了,但

I thought that maybe I had some errors in script and that's the reason so I commented out everything but

param($installPath, $toolsPath, $package, $project)
"ECHO"

但我没有看到 ECHO 出现在包管理器控制台中.有什么问题?

But I don't see ECHO appearing in Package Manager Console. What can be wrong?

推荐答案

Install.ps 只有在 lib 和/或 lib 中有内容时才会调用code>content 文件夹,但不适用于仅工具"包.请参阅此处:

Install.ps will only be invoked if there is something in the lib and/or content folder, not for a "tools only" package, though. See here:

软件包的内容或 lib 文件夹中必须有文件才能运行 Install.ps1.仅仅在工具文件夹中有一些东西不会启动它.

The package must have files in the content or lib folder for Install.ps1 to run. Just having something in the tools folder will not kick this off.

使用 Init.ps1 代替(但是,每次打开解决方案时都会执行此操作).

Use the Init.ps1 instead (however, this will be executed every time the solution is opened).

这篇关于NuGet - install.ps1 不会被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆