NuGet - install.ps1 没有被调用 [英] NuGet - install.ps1 does not get called
问题描述
我正在尝试创建我的第一个 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
和/或 \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:
包必须在 content 或 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屋!