ikvm icon indicating copy to clipboard operation
ikvm copied to clipboard

IkvmReference doesn't produce assembly (fails silently) when providing AssemblyVersion + .jar

Open NightOwl888 opened this issue 1 year ago • 1 comments

When generating an assembly from a .jar that already contains the metadata for version and specifying AssemblyVersion explicitly, the assembly fails to generate and silently fails with a successful build. However, the .dll is not output to the bin directory. I tried with 2 different .jar files that don't have any dependencies, and get the same result.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <IkvmReference Include="objenesis-3.2.jar" AssemblyName="objenesis">
      <AssemblyVersion>3.3.3</AssemblyVersion>
    </IkvmReference>
  </ItemGroup>

  <ItemGroup>
    <IkvmReference Include="byte-buddy-1.10.20.jar">
      <AssemblyVersion>3.3.3</AssemblyVersion>
    </IkvmReference>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="IKVM.Maven.Sdk" Version="1.0.0" />
  </ItemGroup>
</Project>

When removing the AssemblyVersion argument, the assembly is built.

I also attempted specifying the AssemblyName, which is working correctly.

NightOwl888 avatar Jul 09 '22 21:07 NightOwl888

I tried using DisableAutoAssemblyVersion and it works with that option enabled. However, the AssemblyName doesn't require you to specify DisableAutoAssemblyName, so the behavior is inconsistent.

Do we really need boolean properties for these? Why can't the behavior be automatic in both cases?

NightOwl888 avatar Jul 09 '22 21:07 NightOwl888

I just met the same problem but it works when I change the assembly version to match Major.Minor.Build.Revision format.

When I only specified Major.Minor.Build, the built dll would be with version Major.Minor.Build.0 while msbuild still looked for Major.Minor.Build (without .0 revision). I believe that's the cause.

Martin1994 avatar Aug 18 '22 03:08 Martin1994