Skip to content

ThisAssembly constants works, but MSBuild properties are empty #143

Answered by kzu
CCRcmcpe asked this question in Q&A
Discussion options

You must be logged in to vote

You cannot get the values of properties before they are initialized. GitInfo initializes those properties in targets.

You can retrieve them after GitInfo runs, like so:

<Target Name="PopulateInfo" DependsOnTargets="GitInfo" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <PackageId>Crlib</PackageId>
    <Version>$(GitBaseVersion)</Version>
    <Authors>Rcmcpe</Authors>
    <PackageLicenseExpression>MIT</PackageLicenseExpression>
    <RepositoryUrl>$(GitRepositoryUrl)</RepositoryUrl>
    <RepositoryType>git</RepositoryType>
    <RepositoryBranch>$(GitBranch)</RepositoryBranch>
    <RepositoryCommit>$(GitCommit)</RepositoryCommit>
  </PropertyGroup>
</Target>

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@CCRcmcpe
Comment options

@burkenyo
Comment options

@sanjaykulkarni04
Comment options

Answer selected by CCRcmcpe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants