Skip to content

Commit

Permalink
Add section on how to set versions from MSBuild
Browse files Browse the repository at this point in the history
Fixes #210
  • Loading branch information
kzu committed Oct 18, 2022
1 parent fa9407a commit 7b8cc37
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,22 @@ a CI server.
You can read more about this project at the
[GitInfo announcement blog post](http://www.cazzulino.com/git-info-from-msbuild-and-code.html).

### MSBuild

If you want to set other properties in your project, such as `$(Version)` or `$(PackageVersion)`
based on the populated values from GitInfo, you must do so from a target, such as:

```xml
<Target Name="_SetVersion" BeforeTargets="GetAssemblyVersion;GenerateNuspec;GetPackageContents">
<PropertyGroup>
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)+$(GitBranch).$(GitCommit)</Version>
<PackageVersion>$(Version)</PackageVersion>
</PropertyGroup>
</Target>
```

In this case, we're setting the version and package version.

## Details

Exposes the following information for use directly from any MSBuild
Expand Down

0 comments on commit 7b8cc37

Please sign in to comment.