System.BadImageFormatException: Could not load file or assembly Microsoft.Bcl.AsyncInterfaces

0

I currently am trying to connect to a SignalR Asp.net Core 3.1 service from my WPF application. The code works fine until I create a .msi file and try to install it. I am using the Visual Studio Installer Projects.

If I create a build and run it, everything works fine and the WPF-App connects to the SignalR service as it should. I tried copying the build/release folder to another computer which worked fine aswell.

Where the code crashes:

try
{
   _connection = new HubConnectionBuilder()
         .WithUrl(uri)
         .WithAutomaticReconnect()
         .Build();
 }
    catch (Exception e)
 {

Error:

System.BadImageFormatException: The Microsoft.Bcl.AsyncInterfaces file or assembly or a dependency on it was not found. Reference assemblies should not be loaded for execution. They can only be loaded in a loading context for reflection only. (HRESULT exception: 0x80131058)

The WPF project is referencing a .Net Standard 2.0 project and is running on .Net Framework 4.7.2

So my question:

Is there a known problem with the Visual Studio Installer Projects. I assume its the Installer Project, because the project works fine if I just use it without the installer.

c#
wpf
signalr
badimageformatexception
asked on Stack Overflow Jun 19, 2020 by JanMer

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0