✅ dotnet Restore and Targets in NuGet packages not found until second build
Hey folks,
I have a NoTargets project file which contains logic for running our Ci/Cd. This file has a series of functions in there for build automation and running locally. It has logic for using the NuGet package
Then my custom target has a dependency on a target defined within that package called
The solution I am working with has 50+ projects which all need to be versioned so instead of running gitversion per assembly, I run it once and cache it with incremental building by sharing a single generated C# class. Each project calls into the build script using the
The problem is that
I have a NoTargets project file which contains logic for running our Ci/Cd. This file has a series of functions in there for build automation and running locally. It has logic for using the NuGet package
GitVersion which is pulled in as a project reference.Then my custom target has a dependency on a target defined within that package called
GetVersion https://github.com/GitTools/GitVersion/blob/main/src/GitVersion.MsBuild/msbuild/tools/GitVersion.MsBuild.targets#L24. The target looks like this The solution I am working with has 50+ projects which all need to be versioned so instead of running gitversion per assembly, I run it once and cache it with incremental building by sharing a single generated C# class. Each project calls into the build script using the
MSBuild method to make sure the shared class in generated. It looks like this The problem is that
Restore will restore the packages for Build.targets however the targets defined in NuGet packages are not loaded into the current context, so they fail to resolve. The user has to build twice. Is there a simple way to force them to be resolved?GitHub
From git log to SemVer in no time. Contribute to GitTools/GitVersion development by creating an account on GitHub.