我查看了project.json的ASP.Net 5团队 wiki 条目,以确定哪些脚本命令可用,目前列出了以下内容:
{
"scripts": {
"prebuild": "echo before building",
"postbuild": "echo after building",
"prepack": "echo before packing",
"postpack": "echo after packing",
"prerestore": "echo before restoring packages",
"postrestore": "echo after restoring packages"
}
}
这些简单明了,易于理解;但是在 Visual Studio 中,似乎只有 prerestore 和 postrestore 事件实际上会触发。Prebuild 和 postbuild 没有。
默认(beta 6) Visual Studio 2015模板添加了以下Script Command,官方列表中没有:
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
此外,似乎还有其他未记录的命令,我从同事创建的示例项目中继承了这些命令:
"scripts": {
"first-run": "npm install -g gulp bower && npm run update",
"prepare": [ "npm install && npm prune && bower install && bower prune && gulp default" ],
"prepublish": [ "npm install", "bower install", "gulp default" ],
"update": "npm install && npm prune && bower install && bower prune"
}
这些似乎有效(他们执行),但我的同事和我无法找到解释的文档:
- 如果它们有效或已弃用。
- 如果它们特定于 Visual Studio(我相信预发布仅适用于 Visual Studio)
- 确切的执行时间,以及 Visual Studio 如何识别它们(名称似乎很明显,但我更愿意确定)。
为了进一步混淆问题,Visual Studio 2015 intellisense 显示了不在官方列表中的其他命令:
是否有有效的project.json 脚本命令列表、它们的用法等,尤其是对于 Visual Studio 2015?