我查看了 project.json 的 ASP.Net 5 团队Wiki条目,以确定可用的 Script Commands ,当前列出了以下内容:
I have looked at the the ASP.Net 5 teams wiki entry for project.json, to identify which Script Commands are available, and currently the following are listed:
{ "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不会.
These are straightforward, and easy to understand; however in Visual Studio, only prerestore and postrestore events seem to actually fire. Prebuild and postbuild do not.
默认的(beta 6) Visual Studio 2015 模板添加了以下 Script Command ,但不在官方列表中:
The default (beta 6) Visual Studio 2015 template adds the following Script Command, which is not on the official list:
"scripts": { "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] }此外,似乎还有其他未记录的命令,我从同事创建的示例项目中继承了这些命令:
Additionally, there seem to be other, undocumented commands, I inherited these from a sample project created by a colleague:
"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" }这些似乎有效(可以执行),但是我和我的同事找不到文档来说明:
These seem to work (they execute), but my colleague and I am unable to find documentation to explain:
为了进一步混淆事情,Visual Studio 2015 intellisense显示了不在正式列表中的其他命令:
To confuse matters further, Visual Studio 2015 intellisense shows other commands which are not in the official list:
是否存在有效的 project.json 脚本命令,它们的用法等列表,尤其是对于Visual Studio 2015?
Is there a list of valid project.json Script Commands, their usage, etc., especially for Visual Studio 2015?
推荐答案更新2016年5月24日:
Microsoft正在逐步淘汰project.json,然后返回csproj.
Microsoft is phasing out project.json and returning to csproj.
.NET作为平台的主要原则之一是我们希望我们的开发人员能够在所有.NET应用程序模型(WinForms,WPF,UWP,ASP.NET,iOS,Android等)之间共享代码. .这带来了一系列问题,而project.json非常适合构建Web应用程序和类库,但不允许统一其他应用程序模型.
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.
...
在查看了我们的选择之后,很明显将.NET Core项目移动到.csproj/MSBuild会更容易,因此所有.NET项目都使用相同的工具和构建系统.
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日起,在Nuget博客上的更新那
An update on the Nuget blog from 30th March 2016 stated that
Visual Studio编辑器和NuGet扩展支持DNX的最新project.json架构
The latest project.json schema for DNX is supported in the Visual Studio editor and by the NuGet extension
project.json模式列出了以下可用的脚本命令:
The project.json schema lists the following available script commands :
"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 project.json脚本命令的完整列表? (Visual Studio 2015)
发布评论