|
Environment: .NET SDK 5.0.103, GitInfo 2.1.2 Have I did something wrong? Here is the csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net5.0;net5.0-windows</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
</PropertyGroup>
<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>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project> |
Answered by
kzu
Feb 11, 2021
Replies: 2 comments 3 replies
|
The repository remote name is |
0 replies
|
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> |
3 replies
Answer selected by
CCRcmcpe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: