我查看 project.json 的 ASP.Net 5 团队维基条目,以确定哪些脚本命令可用,目前列出以下内容:
{
"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事件似乎真的开始了。预建和后期建设没有。
默认的(beta 6) Visual Studio 2015 模板添加了以下脚本命令,这不在官方列表中:
"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"
}
这些似乎有效(他们执行),但我的同事和我无法找到解释文档: