I have a NuGet package with a targets file which manipulates the PackageVersion depending on the current context (When the branch is master it's creates a preview).
This is working well on a normal project but when I use this in a multi target project it's not working.
How can I correct this?
I have attached a sample project. https://1drv.ms/u/s!At1IZ7t_aXW-iNRchOhliGP8dunGHg?e=11dW4F To reproduce the problem:
- Unzip all files
- You need a local NuGet Feed
- Entry the name of your local NuGet Feed in BuildConfig/publish.bat
- Call publish.bat in BuildConfig
- Run "dotnet pack" in Consumer
This creates a package of consumer with version 1.0.0. This should bie 1.0.0-xdev.
When you change Consumer.csproj so that TargetFramework is used the correct version is created
I have tried the version modification outside of the target but this leads to problems when the version number is specified in a Directory.Build.Targets file
I have tried different BeforeTargets in but nothing worked.