简体   繁体   English

Asp.Net 5语义版本控制

[英]Asp.Net 5 Semantic Versioning

It seems that versioning works differently than in previous versions of .Net. 似乎版本控制的工作方式与之前版本的.Net不同。 The project.json seems to use semantic versioning (from what I have seen online) with the format Major.Minor.Patch-Special. project.json似乎使用了语法版本(我在网上看到的),格式为Major.Minor.Patch-Special。

  1. Does this replace the Assembly version idea or add to it? 这是否取代了Assembly版本的想法或添加到它? Or does it just get used with Nuget. 或者只是与Nuget一起使用。
  2. How does one access the version during runtime. 如何在运行时访问该版本。 I came across Nuget.SemanticVersion object online in the Microsoft.Framework.Runtime package but I can't find out how to retrieve it in code. 我在Microsoft.Framework.Runtime包中遇到了Nuget.SemanticVersion对象,但我无法找到如何在代码中检索它。
  3. Is there a programmatic way to update this value on a build or just custom scripts? 是否有一种编程方式来在构建或自定义脚本上更新此值?

I wouldn't say that versioning has changed in a particularly dramatic way. 我不会说版本控制以特别戏剧性的方式发生了变化。 In a version number xyz, the "x" means "big changes / breaking changes," the "y" means "minor additions and fixes," and the "z" means "very minor fixes." 在版本号xyz中,“x”表示“大变化/破坏变化”,“y”表示“次要添加和修复”,“z”表示“非常小的修复”。 That's pretty close to what Semantic Versioning (SemVer) states. 这与Semantic Versioning(SemVer)所说的非常接近。

In a project.json -based project, there is only one place to specify the version, and that's in the project.json file itself. 在基于project.json的项目中,只有一个地方可以指定版本,而且它位于project.json文件本身。 That one version is a SemVer (eg xyz-prerel ) and is used for the NuGet package version and the assembly version, and the assembly informational version. 那个版本是SemVer(例如xyz-prerel ),用于NuGet包版本汇编版本, 以及汇编信息版本。 If you've explicitly set the assembly version or informational version in the assembly, those will be respected and not overridden. 如果您已在程序集中明确设置程序集版本或信息版本,那么这些将受到尊重而不会被覆盖。 (You can see the code here .) (你可以在这里看到代码。)

At runtime you can read the assembly version through reflection (just like you always could). 在运行时,您可以通过反射读取程序集版本(就像您一直可以的那样)。

When running in a DNX application there's also an ILibraryManager interface that you can use to inspect the running application. 在DNX应用程序中运行时,还有一个ILibraryManager接口,可用于检查正在运行的应用程序。 However, that's a fairly advanced scenario. 但是,这是一个相当先进的方案。

Lastly, in the project.json file you can hard-code the xyz part of the version, eg 1.2.3 but you can also specify a * for the pre-release specifier, eg 1.2.3-* . 最后,在project.json文件,你可以硬编码的版本XYZ部件,例如1.2.3 ,但你也可以指定一个*的预发行符,如1.2.3-* If you use * for the pre-release specifier, you can set an environment variable named DNX_BUILD_VERSION to specify the value of the * , eg beta1 or rc2-54289 . 如果使用*作为预发布说明符,则可以设置名为DNX_BUILD_VERSION的环境变量以指定*的值,例如beta1rc2-54289

There are some feature requests logged to allow more flexibility in specifying the entire version number externally. 记录了一些功能请求,以便在外部指定整个版本号时具有更大的灵活性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM