NikulovE / cld3.net

Compact language detector v3 by Google for .Net
Apache License 2.0
7 stars 4 forks source link

Dll from latest release still Dotnet Framework? #2

Open parmsib opened 6 months ago

parmsib commented 6 months ago

Hello!

I'm having some problems trying to run this lib on a linux machine, on dotnet 8. Is this expected to work on linux? I'm getting the following error

Encountered unexpected error.\nSystem.BadImageFormatException: Could not load file or assembly '/app/CLD3.Net.dll'. An attempt was made to load a program with an incorrect format

When using dotPeek or Rider to inspect the dll from the latest release (2.0) of this repo, It says

[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

I got the impression that the target framework wa intended to be e.g ".NETCoreApp v6.0"? Am I missing something?

Thank you in advance for any help

NikulovE commented 6 months ago

Hello. Please, on Linux try 6.0 of library. There is in release (attached)

parmsib commented 6 months ago

Do you mean this DLL file? image That is the file that says i've been using, and inspecting.

NikulovE commented 6 months ago

Oookey, I will check later and rebuild. Tomorrow

NikulovE commented 6 months ago

Uploaded New Libraries, could you please check

parmsib commented 6 months ago

Thanks for the quick reply and the help!

I have now tried with all DLLs replaced with the ones from the latest release (.Net6.0 library (x64) Second Edition)

When inspecting the dll in dotPeek, it now says the target framework is .NETCoreApp v6.0, but I still get the same error

Encountered unexpected error.\nSystem.BadImageFormatException: Could not load file or assembly '/app/CLD3.Net.dll'. An attempt was made to load a program with an incorrect format

I have tried in two different machines (wsl on my local windows machine, and a docker container on an ubuntu server), and both get the same error.

My .csproj file references the CLD3.Net.dll and CLD3.NetCoreLib.dll like this

    <ItemGroup>
      <Reference Include="CLD3.Net">
        <HintPath>..\StaticLibs\Cld3.Net\CLD3.Net.dll</HintPath>
      </Reference>
      <Reference Include="CLD3.NetCoreLib">
        <HintPath>..\StaticLibs\Cld3.Net\CLD3.NetCoreLib.dll</HintPath>
      </Reference>
    </ItemGroup>

and I have added CLD3.lib and Ijwhost.dll to be copied to the build output

      <Content Include="..\StaticLibs\Cld3.Net\CLD3.lib">
        <Link>CLD3.lib</Link>
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </Content>
      <Content Include="..\StaticLibs\Cld3.Net\Ijwhost.dll">
        <Link>Ijwhost.dll</Link>
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </Content>

It works when running in Rider in my Windows environment, but not in any of my two linux environments. I have no idea why.

NikulovE commented 6 months ago

Will try to built dll in vs code in wsl