You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+40-92
Original file line number
Diff line number
Diff line change
@@ -15,34 +15,50 @@
15
15
16
16
## What is this?
17
17
18
-
Git tag/branch based, full-automatic version generator.
18
+
Have you ever wanted to embed the current version of .NET, its documentation, etc.?
19
+
Furthermore, have you ever wanted to automate such an operation with CI, but found the additional work to be too opaque and numerous?
19
20
20
-
* If you use RelaxVersioner, version handling only use with Git tags/branches/commit messages. Of course you only need to install NuGet package and don't need more tooling knowledge, and easy integrates continuous-integration environments.
21
-
* Target language/environments (Probably fits most current .NET development environments):
22
-
* C#, F#, VB.NET, C++/CLI, NuGet packaging (dotnet cli packer) and plain text forms.
23
-
* All target frameworks (ALL: `net8.0`, `netcoreapp3.1`, `net48`, `net20` and others).
24
-
* Visual Studio 2022/2019/2017/2015, Rider, dotnet SDK cli, MSBuild on .NET 8/7/6/5, .NET Core 3.1/2.2 and .NET Framework 4.6.1 environment (NOT your project target frameworks) and related IDEs.
25
-
* Auto collect version information from local Git repository tags/branch name.
26
-
* Independent AssemblyInfo.cs file, generated code will output into a temporary file. (Not manipulate directly AssemblyInfo.cs file).
27
-
* Place source code location which isn't obstructive for Git. (ex: obj/Debug)
28
-
* You can customize output attribute/values with custom rule set file.
21
+
In C#, such information is conventionally described in the `AssemblyInfo.cs` file:
29
22
30
-
### Result for assembly property at the explorer
23
+
```csharp
24
+
usingSystem.Reflection;.
31
25
32
-

26
+
// Embed version number in assembly attribute.
27
+
[assembly: AssemblyVersion("1.0.21")]
28
+
```
29
+
30
+
However, this is as far as the standard goes.
31
+
It was the developer's responsibility to properly update the embedded version number.
32
+
33
+
RelaxVersioner makes version embedding extremely simple by applying versions via Git tagging.
34
+
Simply put, you can tag a Git tag with `1.0.21` and it will automatically generate and embed an assembly attribute like the one shown above!
35
+
36
+
The assembly with the embedded version number can be partially viewed in the Properties page of Explorer:
33
37
34
-
### Result for assembly wide attributes at ILSpy
38
+

39
+
40
+
If you look in ILSpy, you will also see all the information:
35
41
36
42

37
43
38
-
----
44
+
* Simply install RelaxVersioner's NuGet package into your .NET project and it will embed the version number from your Git tags completely automatically at build time.
45
+
* Don't worry about untagged commits. It can go back in time, find the tag, and apply the automatically incremented version.
46
+
* This is not just a tag. It also embeds additional information such as commit ID, branch name, author name, date and etc. The format can be freely changed.
47
+
* You can also customize the information to be embedded. For example, by embedding the value of variables used in MSBuild, you can also embed detailed information at build time.
48
+
* Version embedding is fully integrated into MSBuild. This means that you can simply install the NuGet package and embed versions directly in the build process of IDEs such as Visual Studio, Rider, Visual Studio Code or in the build process of CI.
49
+
* RelaxVersioner does not contain any environment-dependent code, so it works in almost any .NET environment.
50
+
* A CLI interface also exists. You can embed version numbers in text documents and apply the same version notation to different project systems than .NET (e.g. NPM's `project.json`, `Makefile` and etc.).
39
51
40
52
## Sample output code
41
53
42
-
### For C#:
54
+
The following is a C# example, but F#, VB.net, and C++/CLI are also supported. The output attributes are the same.
55
+
56
+
In addition to the assembly attributes, a `ThisAssembly` symbol is also defined.
57
+
This has the advantage that you can easily retrieve various version information without having to use reflection to search for the attributes:
With this CLI, you can use a combination of RelaxVersioner for different targets than .NET.
266
214
For example, in a CI/CD environment like GitHub Actions, you can apply versions to NPM package generation or embed versions in your text documentation.
0 commit comments