Comments (3)
I have this in my ./src/Directory.Build.props
:
<ItemGroup>
<PackageReference Include="gitinfo" Version="2.0.8" />
</ItemGroup>
<PropertyGroup>
<GitInfoReportImportance Condition="$(Configuration) == 'Release'">high</GitInfoReportImportance>
</PropertyGroup>
<Target Name="Configure" AfterTargets="GitInfoReport">
<PropertyGroup>
<Version>$(GitSemVerMajor).$(GitSemVerMinor).$(GitSemVerPatch)$(GitSemVerDashLabel)</Version>
</PropertyGroup>
</Target>
It works quite well.
/B :)
from gitinfo.
Here's a couple more:
https://github.com/clariuslabs/clide/blob/dev/src/Version.targets
https://github.com/NuGet/NuGet.Build.Packaging/blob/dev/src/Directory.Build.targets
https://github.com/MobileEssentials/Merq/blob/master/src/Merq.targets
from gitinfo.
The Git*
properties are populated when the GitInfo
target runs (and the version ones when GitVersion
runs).
You can't reference those properties before those targets have run. The updated docs on MSBuild go into quite a bit more details on how properties/items/targets are evaluated and run and when. It might be worth checking those out, they are quite well written, I'd say: https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-properties
from gitinfo.
Related Issues (20)
- GitInfo generates empty namespace in some cases HOT 4
- Migration from v2 -> v3 HOT 6
- V3 IsDirty is a string HOT 2
- Branch Names with '/' generate invalid versions HOT 1
- CSC : error SL01: SponsorLink has been incorrectly configured HOT 5
- ThisAssemblyNamespace is ignored when updating from 2.3.0 to 3.0.4 HOT 3
- THIS001 warning on F# project HOT 3
- Update to version 3.x breaks Avalonia projects HOT 2
- SemVer version does not seem to align with GitVersion/GitFlow? HOT 1
- Version 3.0.5: Error 'ThisAssembly.Git' is inaccessible due to its protection level HOT 24
- The name 'IsDirtyString' does not exist in the current context
- IsDirty always false
- IsDirty is no more constant HOT 2
- Linux compatibility issues? HOT 4
- Privacy about SponsorLink with GitInfo HOT 5
- parse('')" cannot be evaluated. version string portion was too short or too long
- Build Date HOT 3
- LangVersion latest and using 11.0 constants HOT 4
- ThisAssembly.Git.Commits returns an incorrect value for .NET 6 app HOT 2
- New tag without version drop semver to zeros HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitinfo.