Accessing $(GitVersion_*) variables from MSBuild #3410
Replies: 2 comments 1 reply
-
Okay, I figured the difference between working and not working cases. Working one looks like this: p.s. And |
Beta Was this translation helpful? Give feedback.
-
The reason it does not work after "Build" is that the "GetVersion" runs after "Build", meaning the said variables are set by the "GitVersion" target and not "Build" |
Beta Was this translation helpful? Give feedback.
-
It's probably stupid question, but I still need to ask it. I can't seem to access GitVersion_* msbuild variables from AfterBuild events. I was able to reduce it with just few trivial lines:
It's doesn't seem that the issue depends on repository or GitVersion.yml (or absence of it). GitVersion intermediate files in obj folder are produced, resulting dll has respective attributes set, everything seems okay. When build with diag logging, it's clear that variables are set too. However when it gets to AfterBuild event, they are either empty or unset.
I must be missing something obvious here, because same constructs work in some other of my projects (way more complicated, with few levels of Directory.build.props and complex dependencies).
Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions