[Solved] BadImageFormatException:

Home Forums Software Development [Solved] BadImageFormatException:

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
  • #7259
    Grant [Tobii]

    Hi @ysato, could you please report the file size of Tobii.EyeX.Client.dll in each output folder?

    64-bit version should be of size 1275kB, otherwise it is  849kB.

    Please also confirm if the following lines appear in the .csproj-file:

      <Import Project="..\..\packages\Tobii.Interaction.0.7.3\build\Tobii.Interaction.targets" Condition="Exists('..\..\packages\Tobii.Interaction.0.7.3\build\Tobii.Interaction.targets')" />
      <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
          <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
        <Error Condition="!Exists('..\..\packages\Tobii.Interaction.0.7.3\build\Tobii.Interaction.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Tobii.Interaction.0.7.3\build\Tobii.Interaction.targets'))" />

    Can you also kindly try to rebuild the project from scratch to make sure the correct files are copied?


    \packages\Tobii.Interaction.0.7.3\build\AnyCPU\Tobii.EyeX.Client.dll 849KB
    \packages\Tobii.Interaction.0.7.3\build\x64\Tobii.EyeX.Client.dll 1,275KB
    \packages\Tobii.Interaction.0.7.3\build\x86\Tobii.EyeX.Client.dll 849KB

    I find the following lines in my csproj file when AnyCPU config. Only one line for import section.

    <Reference Include=”Tobii.Interaction.Model, Version=, Culture=neutral, PublicKeyToken=70326046dcdce6cb, processorArchitecture=MSIL”>
    <Reference Include=”Tobii.Interaction.Net, Version=, Culture=neutral, PublicKeyToken=70326046dcdce6cb, processorArchitecture=MSIL”>

    <Import Project=”..\packages\Tobii.Interaction.0.7.3\build\Tobii.Interaction.targets” Condition=”Exists(‘..\packages\Tobii.Interaction.0.7.3\build\Tobii.Interaction.targets’)” />

    I will try today to rebuild my project from scratch as 64bit app from the beginning.


    I tried to create a new c# project with 64 target.
    I added NuGet Tobii Interaction package before any additional modifications.
    But the files under Tobii package are exactly the same a before.

    Grant [Tobii]

    Hi @ysato, apologies but we are having troubles here understanding why it is not working for you and we cannot reproduce the error here.

    The .Net assemblies referenced in Tobii Core SDK (Tobii.Interaction.Net.dll and Tobii.Interaction.Model.dll) are compiled with an AnyCPU config, so they shouldn’t pose a problem.

    Also, Tobii.EyeX.Client.dll is being correctly created and is different for each architecture. (as you can see the file size difference)

    Maybe you can try to copy the correct native dll to the output folder? Was there a chance to test on another computer?


    >>you can try to copy the correct native dll to the output folder

    I succeeded to run both Tobii sdk and other 64bit dll under 64 config app.

    I checked projectfolfer/bin/debug/Tobii.EyeX.Client.dll. It was 32bit. I copied 64bit Tobii.EyeX.Client.dll to the folder.
    Then my app run as 64 bit.
    That must be a bug of Visual Studio 2015.

    Thanks for a long effort of your support.

    Grant [Tobii]

    Hi @ysato, okay great! Glad to hear you got it working 🙂

Viewing 6 posts - 16 through 21 (of 21 total)
  • You must be logged in to reply to this topic.