Could not load file or assembly 'System - c#

i developed my application using visual studio 2013, then deployed to a window server, current the server has been upgraded to windows server 2022 and my application is breaking and get getting this error:
"Could not load file or assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."
I know its a compatibility issue but hat is the fastest remedy to this.

try putting copy local= true in each DDL's properties that say "Could not load file or assembly"

Related

Remote language server can't activate when I open ASP.Net MVC solution

Recently, my ASP.Net project have been giving me issues, as soon as I open the project it displays the error:
There was an error activating the remote language server, C#/Visual Basic Server Client. For more details, please examine the ActivityLog.xml file.
I examined the ActivityLog.xml file as it suggested, and from the Activity Monitor Log I found the following errors:
#182: Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.Windows.Simulator.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\commonextensions\platform\diagnosticshub\Microsoft.DiagnosticsHub.VisualStudio.Package.dll
#183: Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.UniversalApps.Deployment, Version=16.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\COMMUNITY\COMMON7\IDE\EXTENSIONS\MICROSOFT\GRAPHICS\DEBUGGER\VsGraphicsDebuggerPkg.dll
I tried to repair VS2019 with hopes it will fix this error, but it didn't work. And I'm using the latest version of VS2019 (version 16.8.3).

IBM.Data.DB2 FileNotFound Loading Microsoft.ReportingServices.Interfaces

I have a ASP.Net application which references an assembly with some re-usable code (common utils, data access, etc.). The assembly references IBM.Data.DB2.dll. However, I am not using DB2 in my application, the IBM.Data.DB2.dll is simply a dependency (in case an app needs to connect to DB2). Recently, i've run into the following error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ReportingServices.Interfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.ReportingServices.Interfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at Unity.AutoRegistration.AutoRegistration.<ApplyAutoRegistration>b__5(Assembly a)
at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Unity.AutoRegistration.AutoRegistration.ApplyAutoRegistration()
The only file in the entire application that contains Microsoft.ReportingServices.Interfaces is the IBM.Data.DB2.dll file. I do not have any need of SQL Server or the overhead of a SQL Server installation locally much less on the server when the app is deployed. Bear in mind I am required to use the assembly which has the dependency on IBM.Data.DB2.dll and this error has not happened in the past, it seems to be recent.
I have tried binding redirects, installed Microsoft.ReportingServices.Interfaces via Nuget all to no avail.
Would anyone know why this error is occurring and more importantly....how to resolve it?
If IBM.Data.DB2.dll references Microsoft.ReportingServices.Interfaces, you will probably have to manually copy Microsoft.ReportingServices.Interfaces.dll into your bin folder. Here is a post that can help you with that:
Microsoft.ReportingServices.Interfaces.dll missing for SSRS 2005

Could not load type 'Microsoft.TeamFoundation.Client.BasicAuthCredential' from assembly 'Microsoft.TeamFoundation.Client

I have an MVC app that pulls data from hosted TFS, and when I deploy it I get this error
Could not load type 'Microsoft.TeamFoundation.Client.BasicAuthCredential' from assembly 'Microsoft.TeamFoundation.Client, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
However, I have Microsoft.TeamFoundation.Client referenced in the project and the dll is on the server.
Why would it not be able to load Client.BasicAuthCredential from the dll and how would I go about fixing it?
We've had similar issues and after we installed TFS object model this issue was resolved.
http://visualstudiogallery.msdn.microsoft.com/a37e19fb-3052-4fc9-bef7-4a4682069a75

strange Report VIewer Error: Could not load file or assembly 'App_WebReferences.e8ik1wuc

I'm connecting to a MS NAV 2009 web service in my asp.net 4.0 web application...every other communication with the web service works fine but when i try to create a report with the report wizard i get the error below:
"Could not load file or assembly 'App_WebReferences.e2c6mdeb,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. The system cannot find the file specified."
Copying the assembly to the Bin folder resolves the problem but then another error occurs and the app can't compile. Error:
"The type 'eOnline.LessonsClasses' exists in both
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\cavendishwebonline\9db1de22\42dd86dd\App_WebReferences.zxqfnb5w.dll'
and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\cavendishwebonline\9db1de22\42dd86dd\assembly\dl3\048caf7e\caa8a704_c13fcd01\App_WebReferences.e2c6mdeb.DLL'"
I would appreciate some assistance on this issue.
Please change ajaxtoolkit reference in bin folder(updated version)

FileNotFoundException in Portable Class Library?

I have 3 assemblies, a WP7 app (targeting 7.0), a Web Services project (running 4.0), and a Portable Class Library (built from the template & targeting WP7, SL4 & .NET 4.0) which contains a common type used between the first two.
When run locally (in IIS Express) things work just fine, however when run against a deployed instance of the Web Services assembly (on a remote IIS server I have little control of) fails with the following exception:
System.IO.FileNotFoundException: Could not load file or assembly
'System.Xml.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' or one of its dependencies. The
system cannot find the file specified. File name:
'System.Xml.Serialization, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' ---> System.IO.FileNotFoundException:
Could not load file or assembly 'System.Xml.Serialization,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
Retargetable=Yes' or one of its dependencies. The system cannot find
the file specified. File name: 'System.Xml.Serialization,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35,
Retargetable=Yes'
The stacktrace indicates that it is on the first call into the PCL, which would make sense if it's a type load failure like above.
If I remove the reference to the PCL assembly and then add the key class file to both assemblies, things work fine, however I want to avoid this kind of code duplication... so the question is: Why is this happening? How can I configure the PCL to function as written?
EDIT: A little more information... my PCL uses XmlSerializer, something that lives in System.Xml.dll on the desktop, and in System.Xml.Serialization.xml in Silverlight... an assembly that doesn't exist under the full desktop framework... so this failure makes some sense, only in the PCL world, some of these assemblies/classes are broken out on their own
In this case, XmlSerializer actually lives in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile2\System.Xml.Serialization.dll (which is referenced by the PCL)... as a test I added the same reference to the Web Project... however at runtime of the web project, it fails with yellow screen of death stating that:
Could not load file or assembly 'System.Xml.Serialization' or one of
its dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
You will need to install KB2468871 on the remote server. It's a GDR that has been pushed to most client machines - however, servers will need to opt into it (they typically don't automatically install updates).

Categories