Hi Team,
I am getting below error while running .net core project on Service Fabric Cluster.
System.BadImageFormatException: 'Could not load file or assembly 'System.ComponentModel, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Format of the executable (.exe) or library (.dll) is invalid.'
Please do the neeful.

Avnish KumarRank #1,003 · 2K reputationPosted Dec 3, 2021, 5:47 AM EST
tarun s28 reputationPosted Dec 3, 2021, 6:11 AM EST
Installed nuget package System.ComponentModel and no luck.
(serviceContext)) .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None) .UseUrls(url) .Build(); }))
I tried to change the project to 64 bit and ran the solution but no luck. After that re installed all the softwares like vs and sdks. But still getting the same error at this place on Service layer
new ServiceInstanceListener(serviceContext => new KestrelCommunicationListener(serviceContext, "ServiceEndpoint", (url, listener) => { ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting Kestrel on {url}"); return new WebHostBuilder() .UseKestrel() .UseCommonConfiguration() .ConfigureServices( services => services .AddSingleton
Lakshna S39 reputationPosted Dec 4, 2021, 9:03 AM EST
In many cases, this can be solved by adding the following code to the csproj file of your test project:
geetha geethaRank #7,130 · 248 reputationPosted Dec 6, 2021, 4:02 AM EST