ASP.Net 5 project.json 脚本命令的完整列表? (Visual Studio 2015)
Complete list of ASP.Net 5 project.json Script Commands? (Visual Studio 2015)
我查看了 ASP.Net 5 团队 Wiki 条目 project.json,以确定哪个脚本命令可用,目前列出了以下命令:
{
"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 中,似乎只有恢复前和恢复后事件才真正触发。 Prebuild 和 postbuild 没有。
默认(beta 6)Visual Studio2015模板添加了以下脚本命令,不在官方列表中:
"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?
2016 年 5 月 24 日更新:
Microsoft 正在逐步淘汰 project.json 并返回到 csproj。
One of the key tenets of .NET as a platform is we want our developers to be able to share code across all of the .NET application models (WinForms, WPF, UWP, ASP.NET, iOS, Android, etc). This presented a series of problems, while project.json was great for building web applications and class libraries it did not allow unification of the other app models.
...
After looking at our choices, it was apparent that it would be easier to move .NET Core projects to .csproj/MSBuild so all .NET projects use the same tooling and build system.
2016 年 3 月 30 日的 update on the Nuget blog 表示
The latest project.json schema for DNX is supported in the Visual Studio editor and by the NuGet extension
project.json schema 列出了以下可用的脚本命令:
"scripts": {
"type": "object",
"description": "Scripts to execute during the various stages.",
"properties": {
"precompile": { "$ref": "#/definitions/script" },
"postcompile": { "$ref": "#/definitions/script" },
"prepack": { "$ref": "#/definitions/script" },
"postpack": { "$ref": "#/definitions/script" },
"prepublish": { "$ref": "#/definitions/script" },
"postpublish": { "$ref": "#/definitions/script" },
"prerestore": { "$ref": "#/definitions/script" },
"postrestore": { "$ref": "#/definitions/script" },
"prepare": { "$ref": "#/definitions/script" }
}
},
我查看了 ASP.Net 5 团队 Wiki 条目 project.json,以确定哪个脚本命令可用,目前列出了以下命令:
{
"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 中,似乎只有恢复前和恢复后事件才真正触发。 Prebuild 和 postbuild 没有。
默认(beta 6)Visual Studio2015模板添加了以下脚本命令,不在官方列表中:
"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?
2016 年 5 月 24 日更新:
Microsoft 正在逐步淘汰 project.json 并返回到 csproj。
One of the key tenets of .NET as a platform is we want our developers to be able to share code across all of the .NET application models (WinForms, WPF, UWP, ASP.NET, iOS, Android, etc). This presented a series of problems, while project.json was great for building web applications and class libraries it did not allow unification of the other app models.
...
After looking at our choices, it was apparent that it would be easier to move .NET Core projects to .csproj/MSBuild so all .NET projects use the same tooling and build system.
2016 年 3 月 30 日的 update on the Nuget blog 表示
The latest project.json schema for DNX is supported in the Visual Studio editor and by the NuGet extension
project.json schema 列出了以下可用的脚本命令:
"scripts": {
"type": "object",
"description": "Scripts to execute during the various stages.",
"properties": {
"precompile": { "$ref": "#/definitions/script" },
"postcompile": { "$ref": "#/definitions/script" },
"prepack": { "$ref": "#/definitions/script" },
"postpack": { "$ref": "#/definitions/script" },
"prepublish": { "$ref": "#/definitions/script" },
"postpublish": { "$ref": "#/definitions/script" },
"prerestore": { "$ref": "#/definitions/script" },
"postrestore": { "$ref": "#/definitions/script" },
"prepare": { "$ref": "#/definitions/script" }
}
},