ikvm-maven icon indicating copy to clipboard operation
ikvm-maven copied to clipboard

.NET 9 1.9.3

Open mtmulch0191 opened this issue 6 months ago • 5 comments

Hello there we recently tried to update IKVM-Maven to 1.9.3 on .NET 9 and we get the following stack trace and Visual Studio error about not being able to find the IKVM.Runtime.dll. Project compiles fine on 1.9.2. Is there any insight into this?

<Project>
    <PropertyGroup>
        <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
    </PropertyGroup>

    <PropertyGroup Condition=" '$(TargetFramework)' != '' ">
        <IkvmToolFramework Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netstandard1.0'))">net8.0</IkvmToolFramework>
        <IkvmToolFramework Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net461'))">net472</IkvmToolFramework>
        <IkvmToolFramework Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'netcoreapp3.1'))">net8.0</IkvmToolFramework>
        <IkvmJavaFramework>net8.0</IkvmJavaFramework>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X86'">win-x86</IkvmToolRuntime>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64'">win-x64</IkvmToolRuntime>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('Windows')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'ARM64'">win-arm64</IkvmToolRuntime>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X86'">linux-x86</IkvmToolRuntime>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64'">linux-x64</IkvmToolRuntime>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('Linux')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'ARM64'">linux-arm64</IkvmToolRuntime>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('OSX')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'X64'">osx-x64</IkvmToolRuntime>
        <IkvmToolRuntime Condition="$([MSBuild]::IsOSPlatform('OSX')) And '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'ARM64'">osx-arm64</IkvmToolRuntime>
    </PropertyGroup>

    <!-- Set up default cache information. -->
    <PropertyGroup Condition=" '$(TargetFramework)' != '' ">
        <IkvmStageDir Condition=" '$(IkvmStageDir)' == '' ">$(IntermediateOutputPath)ikvm\stage\1\</IkvmStageDir>
        <IkvmCacheDir Condition=" '$(IkvmCacheDir)' == '' ">$([System.IO.Path]::GetTempPath())ikvm\cache\1\</IkvmCacheDir>
        <IkvmExportStageDir Condition=" '$(IkvmExportStageDir)' == '' ">$(IntermediateOutputPath)ikvm\expstage\1\</IkvmExportStageDir>
        <IkvmExportCacheDir Condition=" '$(IkvmExportCacheDir)' == '' ">$([System.IO.Path]::GetTempPath())ikvm\expcache\1\</IkvmExportCacheDir>
    </PropertyGroup>

    <PropertyGroup>
        <ResolveIkvmRuntimeAssemblyDependsOn>
            $(ResolveIkvmRuntimeAssemblyDependsOn);
            ResolvePackageDependenciesForBuild;
            ResolveProjectReferences;
        </ResolveIkvmRuntimeAssemblyDependsOn>
    </PropertyGroup>

    <!-- Locates the IKVM.Runtime assembly from among the current references of the project. -->
    <Target Name="ResolveIkvmRuntimeAssembly" DependsOnTargets="$(ResolveIkvmRuntimeAssemblyDependsOn)">
        <ItemGroup>
            <_IkvmRuntimeAssembly Include="@(Reference);@(_ResolvedProjectReferencePaths)" Condition=" '%(Identity)' == 'IKVM.Runtime' Or '%(Filename)%(Extension)' == 'IKVM.Runtime.dll' " />
        </ItemGroup>
        <PropertyGroup>
            <IkvmRuntimeAssembly>@(_IkvmRuntimeAssembly)</IkvmRuntimeAssembly>
        </PropertyGroup>
        <Error Text="Could not locate IKVM.Runtime.dll." Condition=" '$(IkvmRuntimeAssembly)' == '' " />
    </Target>

    <!--
    Optionally disable registration of tasks.
    -->
    <Import Project="$(MSBuildThisFileDirectory)IKVM.MSBuild.Tasks.targets" Condition=" '$(UseIkvmTasks)' != 'false' "/>
    <Import Project="$(MSBuildThisFileDirectory)IKVM.MSBuild.NoTasks.targets" Condition=" '$(UseIkvmTasks)' == 'false' "/>

    <!--
    PackageReference mode looks for IKVM tools and assemblies from the included IKVM and IKVM.MSBuild packages.
    ProjectReference mode looks for IKVM tools and assemblies from marked ProjectReferences. Used for internal builds.
    -->
    <Import Project="$(MSBuildThisFileDirectory)IKVM.MSBuild.IkvmToolReference.targets" Condition=" '$(UseIkvmToolReferences)' == 'true' "/>

</Project>

Image

mtmulch0191 avatar Jun 02 '25 20:06 mtmulch0191

Not without seeing your project file, no.

wasabii avatar Jun 02 '25 20:06 wasabii

This looks like the same issue as https://github.com/ikvmnet/ikvm/issues/673 Although the author of that issue seems to have closed it without sharing how they fixed it

Lamparter avatar Jun 02 '25 20:06 Lamparter

This sounds like a TFM precedence issue, I think I've seen it before.

Lamparter avatar Jun 02 '25 20:06 Lamparter

Not without seeing your project file, no.

Thanks. We will continue to look into the problem. One of my colleagues might be jumping into this thread in the future.

mtmulch0191 avatar Jun 04 '25 12:06 mtmulch0191

If it's still needed: I get the same error when compiling this project:

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

  <PropertyGroup>
    <TargetFrameworks>net472;net8.0;net9.0</TargetFrameworks>
    <Nullable>enable</Nullable>

    <Configurations>Debug;Release;TestWindows</Configurations>
  </PropertyGroup>

  <PropertyGroup Condition="  '$(TargetFramework)' == 'net472' ">
    <LangVersion>12.0</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="IKVM.Maven.Sdk" Version="1.9.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="PolySharp" Version="1.15.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

  <ItemGroup>
    <MavenReference Include="org.spdx:java-spdx-library" Version="2.0.0" />
  </ItemGroup>

</Project>

Though the same happens when I use version 1.9.2....

sensslen avatar Sep 06 '25 17:09 sensslen