adamralph/minver

MinVer in WPF projects

Sironas opened this issue · 6 comments

Version(s)

4.0.0 (I also tested on 4.1.0)

To reproduce

Steps to reproduce the issue:

  1. Create a lib project (.Net 6)
  2. Add a WPF component (with a .xaml file)
  3. Set AssemblyVersion to MinVer's variables (major, minor, etc...)
  4. Build the project

Expected behaviour

I expected the project to build

Actual behaviour

Project doesn't build because a target of WPF is launched before MinVer and want to access the AssemblyVersion

Error:
C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets(223,9): Error MC1000: Unknown error build, 'MC1005 : AssemblyVersion not valid detected : ...0.'

NB: I used AssemblyVersion = $(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0

Workarounds

I can make it work if I add this target in my .csproj
<Target Name="ForWpf" BeforeTargets="MarkupCompilePass1" DependsOnTargets="MinVer"/>

Additional context

It seems that the target that generate baml file from xaml files launches before MinVer an makes this problem

I don't know if it's me that doesn't use correctly MinVer with the AssemblyVersion but anyway I wanted to let you know of this problem ;)

@Sironas in your step to reproduce, what does this step mean?

  1. Set AssemblyVersion to MinVer's variables (major, minor, etc...)

How are you setting AssemblyVersion?

@Sironas I'm closing this because a month has passed and you haven't replied. If you are still having problems, please re-open the issue with a response to my previous question.

@adamralph Sorry I was in holidays the last month

I already said in the description of the issue how I set the version:

<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>

I already said in the description of the issue how I set the version:

<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>

  1. That text does not appear in the description.
  2. Where are you doing that? In a target? How does that target look?

Sorry I thought it was obvious as I'm used to it. I will share with you an example

In the .csproj I have this

<Project Sdk="Microsoft.NET.Sdk">
  ...
  <!-- Version number -->
  <PropertyGroup>
    <MinVerMinimumMajorMinor>1.0</MinVerMinimumMajorMinor>
    <AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>
    <FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</FileVersion>
    <IncludeSymbols>true</IncludeSymbols>
    <SymbolPackageFormat>snupkg</SymbolPackageFormat>
  </PropertyGroup>
  ...
</Project>

That will not work. The way to make this work is documented in the FAQ.