Windows error 0x80131058, -2146234280

Detailed Error Information

COR_E_LOADING_REFERENCE_ASSEMBLY[1]

Message"Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context."
Comment Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context.

HRESULT analysis[2]

FlagsSeverityFailure
Reserved (R)false
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode19 (0x013)
NameFACILITY_URT[2][3]
DescriptionThe source of the error code is .NET CLR.[2][3]
Error Code4184 (0x1058)

Questions

41votes
6answers

Cannot load a reference assembly for execution

All of a sudden my website is not loading and giving me below error. I am running VS2017 with .Net Framework 4.7.1 on Windows 10 Home. [BadImageFormatException: Cannot load a reference assembly for execution.] [BadImageFormatException: Could not load file or assembly 'System.IO.Compression.ZipFile' or one of its dependencies. Reference assemblies should [...] read more
asp.net
visual-studio
visual-studio-2017
acumatica
28votes
9answers

'Could not load file or assembly 'netstandard, Version=2.0.0.0, ...'. Reference assemblies should not be loaded for execution

Goal: From a .NET 4.7 console app, using reflection with Assembly.GetType(), I am trying extract the Type of a netstandard 2.0 class from Assembly X. Then I want to create an instance of this Type with Activator.CreateInstance(). What I am trying to do: However, this assembly X has a dependency [...] read more
c#
.net
dll
.net-assembly
.net-standard
22votes
5answers

Reference assemblies should not be loaded for execution

All of a sudden my website is throwing this error message when I try to debug it within Visual Studio. If I deploy the website, it works without any errors. Any suggestions to resolve this error. [ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Win32.Primitives' or one of its dependencies. Reference [...] read more
asp.net-mvc
visual-studio
21votes
6answers

.Net 4.6 website not loading Reference Assemblies correctly

I have a web project in Visual Studio 2013, including several library projects. Problem is that adding a reference (ie. System.Collection, System.Net) to the web project is being added as a 'Reference Assembly' from C:\Program Files (x86)\Reference Assemblies\Microsoft, when loaded in IIS it is not correctly loading the implementation of [...] read more
c#
asp.net
.net
iis
.net-assembly
15votes
2answers

Cannot load a reference assembly for execution from a Web-Site project

Using .NET 4.6.2 and an older Web-Site (not Web-Application) project. If I clear the BIN directory and then build and run it works, but sometimes after multiple builds and runs, it fails with this error. Server Error in '/' Application. Cannot load a reference assembly for execution. .... [BadImageFormatException: Cannot [...] read more
c#
asp.net
web-site-project
.net-standard
12votes
1answer

Porting Windows Forms to .Net Standard 2.0

Apologies if this is a very naive question. I wrote a Windows Form application using .Net 4.5 sometime ago. Recently, I thought it would be a good idea to port it to a .Net Standard 2.0 application using VS Code. There were a couple of problems with missing libraries and [...] read more
c#
.net
winforms
.net-standard-2.0
11votes
2answers

System.Data.Linq in netstandard20

I have a netstandard20 project that references a .Net 4.6 Project, all compiles and runs except where I call any functionality in the .Net 4.6 project, I get the following error. > FileNotFoundException: Could not load file or assembly 'System.Data.Linq, > Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system > cannot find the [...] read more
c#
.net-standard
.net-standard-2.0
9votes
2answers

Is it possible to run Kinect V2 inside a Docker container?

I'm exploring the feasibility of running a C# Kinect Visual Gesture Program (something like Continuous Gesture Basics project https://github.com/angelaHillier/ContinuousGestureBasics-WPF) inside of a Docker for Windows container. 1. Is this even theoretically possible (run C# Kinect in a Docker for Windows container?) 2. If the answer to 1 is yes, here [...] read more
c#
windows
docker
wix
kinect
9votes
2answers

Load UWP library into .NET Framework app

There are a number of articles(codeproject, blog1, blog2, forum) to use WinRT library into .Net Framework console application in Windows 8. I tried it with UWP in Windows 10. But failed to make it. I struggled to compile without error, but it occurred BadImageFormatException in runtime. This is what I [...] read more
c#
.net
windows-runtime
uwp
6votes
5answers

Getting strange BadImageFormatException: Cannot load a reference assembly for execution

I'm getting a crazy system load issue, which I have not idea what it is. The error and the output from the Server Error in '/' Application. Cannot load a reference assembly for execution. Description: An unhandled exception occurred during the execution of the current web request. Please review the [...] read more
c#
.net
msbuild
visual-studio-2017
6votes
2answers

Creating a Windows Forms Application in C# using `dotnet new`

I am trying to create a (simple) windows form application in Visual Studio Code 2017. Sadly I am unable to use the full VS versions, so I don't have the menu options to create new projects. Previously, I have created console projects by running dotnet new console from the terminal [...] read more
c#
.net
winforms
visual-studio-code
5votes
1answer

Could not load file or assembly 'System.IO, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies

Over the last few days, I have been desperately trying to resolve a case of dependency hell I got into after installing a NuGet package which added a bunch of new dependencies from the System.Collections.*, System.Diagnostics.*, System.IO.*, System.Runtime.*, System.Text.*, System.Threading.* and System.Xml.* namespaces. The MVC project I have the issue [...] read more
c#
.net
visual-studio
web-config
nuget
4votes
1answer

Linq to SQL tools - How to use it with ASP .NET CORE 2.1 project?

We have an ASP.NET MVC5 website, I am redesigning it by creating a WebAPI using ASP.NET Core 2.1. We used Linq to SQL tools in the old project. So, I created a Class Library(.NET Framework) as a separate project, and I generated the .dbml file, then referenced it in the [...] read more
c#
asp.net
.net
asp.net-core
linq-to-sql
3votes
1answer

System.BadImageFormatException in UWP with WPF desktop bridge package

I''ve fully and detailed described problem and question in this topic System.NullReferenceException in AppServiceResponse and System.BadImageFormatException of UWP with WPF desktop bridge package, but still have no found answer, what can cause this failure. Topic link to Windows Dev Center above describes assembly, shows all used code with examples, including [...] read more
c#
wpf
uwp
desktop-bridge
badimageformatexception
3votes
0answers

F# Type provider FSharp,Data.SqlClient targeting .NetStandard 2.0 fails when using dotNet Build from commandLine but succeeds in Visual Studion 2019

I am using the F# Type Provider FSharp.Data.SqlClient in a DLL targeting .Net-Standard-2.0, while this successfully builds in Visual Studio 2019 it fails when I try to build it using the command prompt compiler dotNet compiler with the following error message J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\BillOfDocuments\BillOfDocumentsDataAccess.fs(14,27): error FS3033: The type provider 'FSharp.Data.SqlProgrammabilityProvider' reported an [...] read more
f#
.net-standard-2.0
fsharp.data.sqlclient
3votes
1answer

NuGet adds System.Runtime to web.config on every update causing run-time error

I have a solution with multiple projects, two of them being MVC5 web apps. Every time I update any nuget package in any project, the mvc apps' web.config is modified, adding the following: <dependentAssembly> <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> </dependentAssembly> This causes runtime error: > [BadImageFormatException: [...] read more
visual-studio-2013
asp.net-mvc-5
web-config
nuget
2votes
0answers

.Net 5 - using System.Web - Reference assemblies should not be loaded for execution. (0x80131058)

I'm porting a .Net 4.5 Framework app to .Net 5 (I want to publish a single executable with dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained true /p:IncludeNativeLibrariesInSingleFile=true). I packaged dll into a NuGet package. This includes System.web.Services.dll (4.0.300319.18020, a .Net Framework 4.5 dll I think) along with it's dll. [...] read more
.net
msbuild
.net-5
2votes
1answer

Errors when trying to use StackExchange REDIS in Azure Cloud Service Worker Role

I have a solution hosted in Azure that is using ServiceStack.Redis 2.0.601. App Services (Web API) and On-Premise windows services are all working as expected but the Cloud service worker roles are throwing binding errors. 1. Add Binding redirect and enable auto binding redirect in the worker role. 2. Use [...] read more
azure-cloud-services
azure-worker-roles
servicestack.redis
assembly-binding-redirect
2votes
1answer

Getting exeption "An error occurred while writing to logger(s)"

I found in my log-files following error: An error occurred while writing to logger(s). Could not load file or assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058) In case of an [...] read more
c#
azure
asp.net-core
azure-blob-storage
2votes
1answer

Cannot build and run the ASP.NET Boilerplate MVC 5 template

I have recently downloaded the MVC5 ABP template, the project compiles but I get 109 warnings. When executing the project, I get a YSOD. * ABP v3.0.0 * .Net Framework 4.6.1 * Visual Studio 2017 * IIS 7 I get the following error message on YSOD: Cannot load a reference [...] read more
aspnetboilerplate
2votes
2answers

Xamarin project failing to find SkiaSharp in Android or Windows

I confess I'm new to Xamarin and cross-platform development, so apologies if this seems a trivial question, but I've been trying to get to the bottom of it for several evenings now. I have a basic Xamarin Forms application, which runs in Windows 8.1, Windows UWP and Android. It uses [...] read more
xamarin
skiasharp
2votes
1answer

Referencing library using Windows.winmd

WHAT I'M TRYING TO DO I'm trying to create a library (Arduino.dll) to interact with my Bluetooth device from a laptop (Windows 10). This library is intended to be used by a desktop application. To achieve that, I had to reference both Windows.winmd and System.Runtime.WindowsRuntime. WHAT'S WORKING I did write [...] read more
c#
dll
visual-studio-2015
2votes
0answers

VS2015 Universal APP - Could not load assembley (badimageformatexception)

Error to call any method of System.Threading , System.IO or System.ReflectionTypeExtensions that have been imported from nuguet in a universal app aplication, underneath have a exemple : Call : private void Button_Click(object sender, RoutedEventArgs e) { var thread = Thread.CurrentThread; } Error: Could not load file or assembly 'System.Threading.Thread, Version=4.0.0.0, [...] read more
win-universal-app
badimageformatexception
visual-studio-2015
1vote
1answer

Issue with nested DLL referencing in a self-contained .Net Core web app running as a Windows service

The Error First off, lets start with the error message: > System.BadImageFormatException: 'Could not load file or assembly > 'System.Management, Version=4.0.0.0, Culture=neutral, > PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded > for execution. They can only be loaded in the Reflection-only loader context. > (0x80131058)' In my experience, this type [...] read more
asp.net-core
windows-services
1vote
0answers

Could not load file or assembly 'System.ComponentModel.TypeConverter netcore 1.1

I got this exception when I run my project in docker container with netcore 1.1 > to type 'System.String'. ---> System.BadImageFormatException: Could not load > file or assembly 'System.ComponentModel.TypeConverter, Version=4.0.0.0, > Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should > not be loaded for execution. They can only be loaded in the Reflection-only [...] read more
c#
asp.net-core
badimageformatexception
1vote
1answer

Microsoft.Bcl.AsyncInterfaces error (in CSVHelper method) when running the application installed by Visual Studio Setup project

I have a WPF application that reads a CSV file using CSVHelper which I installed using NuGet. Here's the project, system, etc version info. > Microsoft Windows 7 Professional Version 6.1.7601 Service Pack 1 Build 7601 > > Microsoft Visual Studio Community 2019 Version 16.4.5 > > NuGet Package Manager [...] read more
wpf
visual-studio
setup-project
csvhelper
base-class-library
1vote
1answer

How to call AZURE DEVOPS rest API in the water fall dialog built using C# BOT Framework SDK V4?

I have web channel chat bot created through C# using BOT Framework SDK V4. It has multiple waterfall dialogs that do set of actions based upon option selected in the main dialog. In one of the dialog my requirement is user inputs some data and then using that I should [...] read more
c#
azure-devops
botframework
chatbot
azure-devops-rest-api
1vote
1answer

Could not load file or assembly 'netstandard' or one of its dependencies

I upgraded my solutions ElasticSearch.net and nest library to 7.1.0 version. After deploying the code I am getting below error: BadImageFormatException: Could not load file or assembly 'netstandard' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader [...] read more
elasticsearch
nest
.net-framework-version
elasticsearch.net
1vote
0answers

Could not load file or assembly 'System.Data.SqlClient,...'

I'm having trouble using system.data.sqlclient namespace. I have made a very simple console application to save entered data in database. Need help regarding this, please help. I have attached screenshot of console. using System; using System.Data.SqlClient; namespace StudentDetails_Proj { class Program { static void Main(string[] args) { Console.WriteLine("Enter Name:"); string [...] read more
c#
sql-server
sqlclient
1vote
1answer

I am implementing in ASP.NetCore 2.1 MVC application Saml2.0 , no idea from where to proceed

I am trying to implement saml 2.0 in Asp.NetCore 2.1 MVC application, the requirement is to implement Saml 2.0 with ADFS3.0, I tried from blog and installed nugget - Sustain.saml2.0, throwing me error with system. > BadImageFormatException: Could not load file or assembly > 'System.IdentityModel, Version=4.0.0.0, Culture=neutral, > PublicKeyToken=b77a5c561934e089'. Reference [...] read more
asp.net-mvc
saml
asp.net-core-2.1
onelogin
itfoxtec-identity-saml2
1vote
1answer

Issue with Asp.Net MVC App - Cannot load 'System.Diagnotics.Tracing'

I have an ASP.Net MVC app on .Net 4.7.2. I updated some nuget packages, and now when the application runs I receive an error as below. I have downgraded the System.Diagnostics.Tracing nuget package and then upgraded it to version 4.3.0 but the error still occurs. Server Error in '/' Application. [...] read more
c#
asp.net
asp.net-mvc
1vote
4answers

Is it possible to load platform specific .net libraries in net core?

My goal is to create a plugin type structure where my net core 2.0 library attempts to load an unknown (until runtime) type by reflecting through libraries in a folder. Some of these types may require platform specific implementations. I've attempted this by dynamically loading a .net framework 4.6.1 library [...] read more
c#
reflection
.net-core
cross-platform
1vote
1answer

SGEN error about assembly with incorrect format on VSTS

I have a solution that has the following (simplified) structure: Application.sln |- Business.csproj |- DAL.vbproj Both projets target .NET Framework 4.5.2. It builds both locally and in VSTS. I have now added a NuGet package reference in the DAL project, to a .NET Standard 1.1 dll. It still build perfectly [...] read more
.net
visual-studio
visual-studio-2017
sgen
1vote
1answer

Microsoft Security Advisory 4021279 System.BadImageFormatException

My application is an ASP.NET Core 1.0 Web API. According to the Microsoft Security Advisory 4021279, I wanted to update the direct dependicies of my project. In the MyClassName.csproj is the following line: <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" /> which I change to: <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.4" /> because the versions 1.0.0, 1.0.1, [...] read more
c#
.net
visual-studio
0votes
0answers

how to install PresentationFramework.dll in windows 10

I've been using Visual Studio 2019 and .Net core 3.0 preview 5. I have tried to make unit tests but i couldn't because i have an exceptionMessage: System.BadImageFormatException : Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Reference assemblies should not be loaded for execution. They can only [...] read more
windows-10
visual-studio
.net-framework
assembly
0votes
0answers

BadImageFormatException when creating installer with VisualStudio 2019

hope you are doing great. I am trying to create an installer for my project (a modified MissionPlanner, for those who know that open source software) with VisualStudio 2019. I am doing it with the setup project of Visual Studio. I managed to create an installer, and install the software [...] read more
visual-studio
badimageformatexception
0votes
1answer

Error trying to add a web reference to dotnet core project. User canceled out of save dialog (Exception from HRESULT: 0x8004000C (OLE_E_PROMPTSAVECA

I have a dotnet core project that I need to a web reference to. I select the Microsoft WCF Web Service Reference provider and select the URL and click "Go" The correct service shows up under the "services" window. I change the namespace to something like mynewservice and press "finish." [...] read more
c#
wcf
.net-core
web-reference
0votes
0answers

.NET 5.0 Referencing library in .licx file cause build time errors

Introduction We're trying to port a library to .NET 5.0, but sadly faced an unexpected error during this process. One of our libraries is signed and contains a class that uses .NET LicenseProvider class for license check. Design time invocation is required for licensing configuration and might be implemented (just [...] read more
c#
.net
dll
licensing
.net-5
0votes
0answers

ObjectDataProvider in .Net 5 throws System.BadImageFormatException

I am trying to use ObjectDataProvider in a .Net-5 Web App. Therefore I need to use System.Windows.Data, which can be used with the PresentationFramework.dll. I included the assembly with NuGet (<PackageReference Include="PresentationFramework" Version="4.6.0" />). Already when I build my app I get the following warnings: warning NU1701: Package 'PresentationFramework 4.6.0' [...] read more
c#
.net
serialization
.net-5
0votes
0answers

Could not load file or assembly 'netstandard' or one of its dependencies when publishing in Hostgator

My web app works fine in my development machine, but when I published in web via Hostgator, it gives me this error consistently: [BadImageFormatException: Could not load file or assembly 'netstandard' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in [...] read more
c#
.net
model-view-controller
0votes
3answers

.NET Core vs .NET Framework - Could not load file or assembly 'System.ServiceModel, Reference assemblies should not be loaded for execution

I have an ASP.NET Core 3.1 web app. This application needs to load and execute some code from a 3rd party .NET Framework dll. Unfortunately, the 3rd party code seems to have a dependency (or something else?) on System.ServiceModel, and when I call the code from that DLL, it throws [...] read more
c#
.net
.net-core
0votes
0answers

How to set permission for IIS User to use "System.Security.Cryptography.Csp" on the IIS?

Working on a .net core (.NET Core 5) Restfull API project and want to Decrypt data that comes from another application. It works fine on the local but not working on the IIS(ver 7) and it seems it can not find file "System.Security.Cryptography.Csp.dll" or has not permission to access it. [...] read more
c#
.net-core
rsacryptoserviceprovider
0votes
0answers

does "dotnet script" (csx) support ASP.NET Core app development?

I am checking out "dotnet script" (csx) available here: https://github.com/filipw/dotnet-script I am able to get basic examples working fine. However, I am trying to check the possibility of ASP.NET Core using "dotnet script" (just using plain csx). main.csx: #r "netcoreapp3.1\Microsoft.AspNetCore.dll" #r "netcoreapp3.1\Microsoft.AspNetCore.Hosting.dll" #r "netcoreapp3.1\Microsoft.Extensions.DependencyInjection.dll" #r "netcoreapp3.1\Microsoft.Extensions.Hosting.dll" #load "Startup.csx" using System; [...] read more
c#
asp.net-core
.net-core
csx
dotnet-script
0votes
1answer

Can't seem to fix: System.BadImageFormatException: Could not load file or assembly 'System.Data.SqlClient'

I have 3 projects in my solution (ASP.NET MVC, Unit Test, Class library). I want to unit test a method in a class of the class library. This class uses system.data.sqlclient. When I try to run the unit test this error shows: > System.BadImageFormatException: Could not load file or assembly [...] read more
c#
mysql
nuget
0votes
1answer

Unable to use Mono.Data.Sqlite.dll in Visual Studio

Good afternoon, I wrote some code with MonoDevelop on Linux. The program that i'm writing use Sqlite to store datas, so i've imported the Mono.Data.Sqlite, and it work perfectly. MonoDeveloper imported libraries When i tried to copy the project on Windows and opened with Visual Studio 2019, i've got some [...] read more
c#
sqlite
mono
visual-studio-2019
monodevelop
0votes
0answers

.NET Core 3.1 and Could not load file or assembly System.Data.Entity

The similar problem is written here, but not totally same. I have a new Core 3.1 web project and old .netFramework 4.0 project working with EntityFramework (like BLL). I'm trying to create an instance of the class from that BLL and getting an error "System.IO.FileNotFoundException: 'Could not load file or [...] read more
c#
entity-framework
0votes
1answer

Failed to save a file using ExcelFile

Im using ExcelFile to edit a excel file, then saving it as a pdf file. Everything is working on ASP.Net, but when im using Blazor it didn't work. The error that i got is: "Could not load file or assembly 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file [...] read more
c#
asp.net
blazor
0votes
1answer

Visual Studio Installer Project packaging DotNetCore instead of Framework

I've been going circles on this one for over a day now. I have a WPF project that is making use of sqlite-net-pcl. I'm ready to package this project up into an MSI for distribution (x64). The first hitch was that I need to directly add the nuget for the [...] read more
visual-studio
installation
windows-installer
sqlite-net-pcl
0votes
0answers

Problems with the System.Windows.Form package with C# (Visual Studio)

I am VERY new to C# and I'm trying to make a program that will simulate a mouse right-click when it detects sound. Here is my code... The error I keep getting is below. I have been trying to figure out how to properly get System.Windows.Forms to work, but I [...] read more
c#
.net
visual-studio
reference
project
0votes
0answers

.NET build output using nuget "reference assemblies" instead of actual libraries: Reference assemblies should not be loaded for execution

I have a project that when I run it as a console application it works just fine. It gets the correct package references via nuget and works. I am trying to use Npgsql which is the root of the problem. When I built my Azure cloud project that uses this [...] read more
c#
.net
npgsql
0votes
0answers

VSC C#: Referencing Microsoft DLLs

I'm trying to port a C# .NET Core project from Visual Studio 2019 to Visual Studio Code, although I have no experience with using VSC for C#. I managed to set up NuGet references using dotnet add package, however I cannot wrap my head around importing DLLs that are already [...] read more
c#
.net
visual-studio
visual-studio-code
0votes
0answers

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

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 [...] read more
c#
wpf
signalr
badimageformatexception
0votes
0answers

VS2019 Must DELETE /bin folder and recreate in order for solution to debug

I have a VS2019 ASP.NET (MVC 5) Solution with which I must delete and recreate the /bin folder in order for the solution to compile and debug. Once I delete it, it runs fine until I restart (close/open VS & the project) and attempt to debug again. I began getting [...] read more
.net
asp.net-mvc-5
visual-studio-2019
.net-framework-version
0votes
0answers

BadImageFormatException error after upgrading to .NET 472

Following on from an upgrade from .NET 461 to 472, when I attempt to run my project, I am getting the error message below I have cleaned/rebuilt my project. I have deleted the bin and obj folders all with no luck Is there anything I need to do with NuGet [...] read more
c#
.net
visual-studio
0votes
1answer

How to add built-in assembly from .Net Core to a C# project in VS Code

How to add .Net Core built-in assembly, say, System.Windows.Forms, to a C# project in VS Code? This can easily be done in Visual Studio by using the Reference Manager. However, I got stuck with VS Code. There is tutorial on how to add assembly from NuGet Package but I couldn't [...] read more
c#
visual-studio-code
.net-assembly
0votes
1answer

Azure Function v2 and system.text.json

I am trying to implement a function that uses .net core 3 (preview 9) as a target framework and uses the new System.text.json namespace. Here is my code: using System; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Host; using Microsoft.Extensions.Logging; using System.Text.Json; namespace Backtester { public class Test { public string Author { get; [...] read more
.net-core-3.0
system.text.json
0votes
0answers

Nunit test project cannot load System.Windows.Forms assembly to test a windows form based application targeting .Net 4.6.1

We have a Nunit test project targeting .Net Core 3.0 . This test project writes tests against a windows form based project which has target framework of 4.6.1 and a class library project also targeting 4.6.1. Although I can write test for the class library project but am unable to [...] read more
c#
.net-core
nunit
tdd
.net-framework-version
0votes
1answer

How to reference an assembly within the context of an ASP.NET web application

I am facing a pretty harsh issue with my ASP.NET web app, I am using visual studio community 2017, target framework .NET core 2.2. I have to parse a JSON string and found that the System.Web.Script.Serialization can be pretty useful in this situation. Unfortunately, it seems like visual studio is [...] read more
asp.net-core
javascriptserializer
0votes
1answer

Issues with System.Net.Http.dll

I'm having issues referring to System.Net.Http.dll version 4.2.0.0 Here is my setup - > Visual Studio 2017, 15.8.7 > > A simple console application targeting .net 4.7.2 When I create a new project, by default it has a reference to System.Net.Http.dll and the location is C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Net.Http.dll. But [...] read more
c#
.net
http
json.net
0votes
1answer

Received compile error when upgrading from 2018R1 to 2018R2

I have an instance with our custom project and the Amazon Integration project published. Both projects work fine in 2018R1. During the upgrade I had to update the database first and then the application. The regular update of both at the same time did not work. Once the update completed [...] read more
acumatica
0votes
1answer

Problems installing Application Insights on .NET 4.7.2 from Visual Studio

First of all I got all kinds of weird errors trying to use Visual Studio 15.9 Preview 1 including all kinds of popups during installation. I reverted back to Visual Studio 15.8 RTM but still received errors. This is what I see trying to open my ASP.NET application. [BadImageFormatException: Cannot [...] read more
asp.net-mvc
azure-application-insights
0votes
1answer

autofac docker dependency issues

I've created a web api project (aspnetcore v2.1.0 packages) with this csproj configuration: and autofac version 4.8.1 <PropertyGroup> <TargetFramework>netcoreapp2.0</TargetFramework> <Platform>AnyCPU</Platform> <RuntimeIdentifiers>linux-x64;win-x64</RuntimeIdentifiers> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> I create a publish output with this configuration in my publishprofile: <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <WebPublishMethod>FileSystem</WebPublishMethod> <PublishProvider>FileSystem</PublishProvider> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedPlatform>Any CPU</LastUsedPlatform> <SiteUrlToLaunchAfterPublish /> <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <ExcludeApp_Data>False</ExcludeApp_Data> <ProjectGuid>[SOMEGUID]</ProjectGuid> <publishUrl>publish\</publishUrl> <DeleteExistingFiles>True</DeleteExistingFiles> [...] read more
docker
asp.net-core
autofac
0votes
1answer

Visual Studio Test vs Form application

This is Visual Studio 2017 V15.5.2, and none of the proposed fixes apply. I have a simple test which fails to execute with an exception on the "Dim comp" line. > System.BadImageFormatException: 'Could not load file or assembly > 'System.IO.FileSystem, Version=4.0.1.0, Culture=neutral, > PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference [...] read more
vb.net
visual-studio
xunit.net
0votes
1answer

Use Omron libraries in .NET Core 2.0

I'm trying to use Omron libraries (i.e. Compolet) in an ASP.NET Core 2.0 application. I added the assembly reference for those classes, but at run-time they try to locate the System.Windows.Forms assembly - obviously not available in ASP.NET Core. The exact error is: > FileNotFoundException: Could not load file or [...] read more
c#
asp.net
.net
libraries
0votes
2answers

Issue with System.IO.Compression

I have a PowerShell v2 script with .Net 4.5 which compresses old files. Like this: [Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") ... $files = Get-Childitem ... ... $zip = [System.IO.Compression.ZipFile]::Open($arcpath + $curname, "Create") foreach ($onefile in $files) { [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip, $onefile.FullName, $onefile.Name, "Optimal") | out-null } It worked fine until I have installed .Net 4.6.1 (which [...] read more
powershell
zip
0votes
0answers

Dynamic loading NET46 dll from NETCORE11

I have a netcore1.1 library project using EFCore and more NETCore based libraries, which uses plugins. some of the plug-ins was not ported into net-core and are targeting net40 and net46... and they are not targeting the frameworks of my running, loading, assembly. Now it is logical, I will run [...] read more
c#
.net
dll
asp.net-core
multiplatform
0votes
1answer

Using Vector3 in code behind crashed Visual Studio XAML designer

In my UWP app project using Visual Studio 2015 Update 3, I have a custom control that references Vector3 class to apply some shadow effect in code behind. In another page where I use this custom control, the XAML designer crashes with the following error: BadImageFormatException: Could not load file [...] read more
visual-studio
xaml
uwp
0votes
0answers

problems with System.Net.Security package

I am using package: > "System.Net.Security": "4.0.0-beta-22416" PackageRestore works without any problems. But if my code execution gets to place where I am using System.Net.Security I get this error message: > Exception thrown: 'System.BadImageFormatException' in NetNextTest > > Additional information: Could not load file or assembly 'System.Net.Security, > Version=4.0.0.0, Culture=neutral, [...] read more
c#
.net
.net-core
0votes
0answers

Portable class library and Universal Windows App with Kinect v2

Using Visual Studio 2015, I need to create a Universal Windows App and I want to add a Portable Class Library in the same solution. In this Portable Class Library I want to add a reference to Microsoft.Kinect.dll . But when I execute the code in Local Machine, I get [...] read more
c#
win-universal-app
kinect
portable-class-library
windows-10-universal
0votes
1answer

BadImageFormatException - How to reference System.IO.Compression in my Windows Phone 8.1 app?

I need to reference System.IO.Compression to use ZipArchive class in my Windows Phone Silverlight 8.1 app. I add it with Object Explorer so it copies the dll C:\Program Files\Reference Assemblies\Microsoft\Framework.NETCore\v4.5.1\System.IO.Compression.dll to my root path project, which is copied in the .xap package. I can build but my app crashes at [...] read more
c#
.net
dll
windows-phone
-1votes
1answer

Could not load file or assembly 'System.Web.Services, Version=4.0.0.0

I have successfully integrated sales force SOAP api in to .Net Standard 2.0 class library project and its working fine. Now when I am trying to use this class library to call salesforce into ASP.NET Core2.2 project its giving me error as: > Could not load file or assembly 'System.Web.Services, [...] read more
c#
asp.net-core
soap
salesforce
.net-standard
-1votes
2answers

System.BadImageFormatException: Reference assemblies should not be loaded for execution

I have added the reference file "System.Speech" from > "Program Files (x86)\Reference > Assemblies\Microsoft\Framework.NETFramework\v4.5.2\System.Speech.dll". It is required for proper execution of my program. Here is my program: using System; using System.Speech.Synthesis; namespace ConditioningSchemas { class Program { static void Main(string[] args) { Console.WriteLine("Initializing..."); SpeechSynthesizer synth = new SpeechSynthesizer(); // Initialize [...] read more
c#
.net
visual-studio
-2votes
1answer

Adding reference to an assembly from .NET Standard 2.0 project causses error

I have a .NET Standard 2.0 class library and I want to add a reference to System.DirectoryServices. Everything looks ok, but at runtime I got this error: > Cannot load a reference assembly for execution The detail description is this: > Could not load file or assembly 'System.DirectoryServices, Version=4.0.0.0, > [...] read more
c#
.net-standard

Comments

Leave a comment

(plain text only)

Sources

  1. https://github.com/dotnet/coreclr/blob/v1.1.0/src/inc/corerror.xml
  2. https://msdn.microsoft.com/en-us/library/cc231198.aspx
  3. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0