Skip to content

Parent library version mismatch within same solution #134

@Noggog

Description

@Noggog

Hey Kzu! Thanks for the amazing tool. I'm having some odd results that I believe will end up being improper target definitions, but I'm not sure. I have a solution with several projects. There's several projects that depend on another project within this same solution. I have a custom target that is setting my assembly versions that I stuck in my Directory.Build.Props:

 <Target Name="SetVersion" AfterTargets="GitVersion" BeforeTargets="GetPackageVersion;GitThisAssembly" Condition="'$(ExcludeRestorePackageImports)' != 'true'">
    <PropertyGroup>
      <DevLabel Condition="'$(GitCommits)' != '0' or $(GitIsDirty) == 'true'">.1-dev</DevLabel>
      <AssemblyDevLabel Condition="'$(GitCommits)' != '0' or $(GitIsDirty) == 'true'">.1</AssemblyDevLabel>
      <AssemblyVersion>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel)</AssemblyVersion>
      <FileVersion>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(AssemblyDevLabel)</FileVersion>
      <PackageVersion>$(GitBaseVersionMajor).$(GitBaseVersionMinor).$(GitBaseVersionPatch)$(DevLabel)</PackageVersion>
      <InformationalVersion>$(PackageVersion)</InformationalVersion>
    </PropertyGroup>
  </Target>

Pretty similar to other targets people have posted in other issues. It sets my assembly version, and my nuget package version just fine. I have my project to automatically build nuget packages and everything seems to line up... except:

I've noticed that each nuget/assembly gets the proper version stamps, but within each nuget, the version numbers of their parent packages is not set. For example:

My Solution/
   My Project A/
   My Project B/    <--- Depends on A

If I build, I might get a version 0.1.2.3 stamped on A and B's assemblies, and resulting nuget packages. However, B's nuget package will list that it depends on v1.0.0.0 of A. I interpret this as that it wasn't set, and defaulted to v1? Something in the pipeline isn't being set at the right time?

Is there something wrong with my targets, or something at play that you're aware of to cause the missing parent dependency version numbers being set? I'm super excited to let GitInfo drive everything, but this is one last hurdle to letting it run wild for me. Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    need infoMore info needed to diagnose the issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions