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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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