-
I'm trying to use MinVer to set the Version Tags of Container images build according to Publish as a Container. During the build, MinVer sets the Version variable correctly, but when it is used to tag the container, it is empty. Here is the project file with the log output: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup>
<ContainerImageTags>latest;x$(Version)y</ContainerImageTags>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<MinVerVerbosity>detailed</MinVerVerbosity>
</PropertyGroup>
<Target Name="VersionMessageBefore" BeforeTargets="PublishContainer">
<Message Text="=== Version is: $(Version)" Importance="high" />
</Target>
<Target Name="VersionMessageAfter" AfterTargets="PublishContainer">
<Message Text="=== Version is: $(Version)" Importance="high" />
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Build.Containers" Version="8.0.100" />
<PackageReference Include="MinVer" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project> with calling
I expect to get a Tag 'x2.1.3y', but instead I get 'xy'. I added the 'x' and 'y', as with just $(Version) the tag is completely ignored. It also doesn't work when just setting a singular ContainerImageTag. I think it worked in the past, but I couldn't get it to work by downgrading to dotnet7. I also tried MinVer 5.0.0-beta.1 which didn't make a difference. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You need to do something like this. E.g. <Target Name="MyTarget" AfterTargets="MinVer">
<PropertyGroup>
<ContainerImageTags>latest;x$(Version)y</ContainerImageTags>
</PropertyGroup>
</Target> |
Beta Was this translation helpful? Give feedback.
-
Well that was much easier than expected. Thanks for the fast help! |
Beta Was this translation helpful? Give feedback.
You need to do something like this.
E.g.