Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dasmulli/simplegitversion
Simple Git prerelease versioning integrated into SDK-based msbuild projects
https://github.com/dasmulli/simplegitversion
dotnet git msbuild nuget-package versioning
Last synced: about 3 hours ago
JSON representation
Simple Git prerelease versioning integrated into SDK-based msbuild projects
- Host: GitHub
- URL: https://github.com/dasmulli/simplegitversion
- Owner: dasMulli
- License: mit
- Created: 2017-03-07T18:34:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-14T20:35:52.000Z (about 5 years ago)
- Last Synced: 2024-11-07T10:03:39.155Z (about 3 hours ago)
- Topics: dotnet, git, msbuild, nuget-package, versioning
- Homepage:
- Size: 29.3 KB
- Stars: 17
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Super simple Git prerelease versioning
This is a build utility package that adjusts your `csproj` / `vbproj` project's NuGet and `AssemblyInformalVersion` based on the current git repository's branch name and commit count by making use of the VS 2017 SDK-based project system.Use it like this in your project:
```xml
netstandard1.6
1.2.3
```
If you are on the `master` branch and have 23 commits, the resulting version will be:
```
1.2.3-master-0000023
```If you are on the `feature/awesome` branch and have 25 commits, the resulting version will be:
```
1.2.3-feature-awesome-0000025
```## Define Release labels for known branches
For known branches, you can define custom release lables (think of it as branch name to label dictionary):
```xml
```
If you are on the `master` branch and have 23 commits, the resulting version will be:
```
1.2.3-rc-0000023
```If you are on the `feature/awesome` branch and have 25 commits, the resulting version will be:
```
1.2.3-feature-awesome-0000025
```## SemVer 2.0.0
For SemVer 2.0.0, you'll want your branch name and commit count be separate prerelease lables, separated by a single dot (`.`) and no zero-padding for the commit count. This can be enabled by setting the property `UseCompatGitVersion` to `false`.
Because older NuGet clients and feeds(!!) might not fully support SemVer 2.0.0, the "compatible" SemVer 1.0.0 version is used by default. Note that the support for pre-set `VersionSuffix` values is limited (there will be a dash).But if you like to live dangerously, you can easily enable SemVer 2.0.0 versions using:
```xml
netstandard1.6
1.2.3
false
```
If you are on the `master` branch and have 23 commits, the resulting version will be:
```
1.2.3-master.23
```If you are on the `feature/awesome` branch and have 25 commits, the resulting version will be:
```
1.2.3-feature-awesome.25
```## Omit branch name in version suffix but use a custom label
The well-known `VersionPrefix` is considered while the final version is calculated, so you can define it yourself and tell `SimpleGitVersion` to not care about branch names:
```xml
netstandard1.6
1.2.3
foo
false
```
If you are on ANY branch and have 23 commits, the resulting version will be:
```
1.2.3-foo-0000023
```## Manually disable prerelease version generation
For release builds, you usually want to omit prerelease versions being generated. There is a property that can be used to disable all git version generation: `DisableGitVersionSuffix`. You can use it like this in your build scripts (not that a prerelease version will still be generated if you set `VersionSuffix` in your project file):
```sh
> dotnet pack /p:DisableGitVersionSuffix=true
```## More control and re-using the values calculated by SimpleGitVersion
See the [msbuild target's inline documentation](DasMulli.SimpleGitVersion/build/DasMulli.SimpleGitVersion.targets) for more details.