## Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics' or one of its dependencies

could not load file or assembly dll
could not load file or assembly or one of its dependencies an attempt was made
could not load file or assembly version=1.0.0.0 culture=neutral publickeytoken=null
could not load file or assembly visual studio 2017
could not load file or assembly powershell
could not load file or assembly 'unity abstractions
could not load file or assembly visual studio 2019
could not load file or assembly net core

My system crashed a couple of days ago, since then when I try to debug local Azure environment I get this error 'Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics' or one of its dependencies'.

I have reinstalled the following (Windows Azure tools for MS VS 2012 June 2012 sp1, Windows Azure emulator - June 2012, Windows Azure Librarires for .net - June 2012).

Still having the same issues, any suggestions.

=== Pre-bind state information ===
LOG: User = ...........
LOG: DisplayName = Microsoft.WindowsAzure.Diagnostics
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.WindowsAzure.Diagnostics | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
LOG: Appbase = file:///C:/Projects/Client/Connection Intelegence/CICloud/CIWebRole/
LOG: Initial PrivatePath = C:\Projects\Client\Connection Intelegence\CICloud\CIWebRole\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Projects\Client\Connection         Intelegence\CICloud\CIWebRole\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Using application configuration file: C:\Projects\Client\Connection Intelegence\CICloud\CIWebRole\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]
[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +142
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +203
System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12881540
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159


It looks like this is happening when your application starts. Take a look at your web.config, do you have a trace listener pointing to the Microsoft.WindowsAzure.Diagnostics assembly? That might be the reason why your application is not working.

First, take a look at your assembly references and delete Microsoft.WindowsAzure.Diagnostics should it be present (just to be sure we don't use old versions). Then, add a reference to Microsoft.WindowsAzure.Diagnostics, but make sure this is version 1.7.0.0.

You should find the right version of this assembly in: C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\2012-06\ref

Could not load file or assembly or one of its dependencies, Check if you are referencing an assembly which in turn referencing an old version of unity. For example let's say you have an assembly called  How to resolve “Could not load file or assembly … or one of its dependencies” and why this exception thrown in .Net? Chirag Rupani. Follow. May 31,

I know this is an old topic but it's still the top Google result for "Could not load file or assembly Microsoft.WindowsAzure.Diagnostics", so here is what I did:

This was happening to me with the Azure SDK 2.7.1 and Visual Studio 2013. Somewhere between upgrading to Windows 10 and Azure SDK 2.7, something didn't get installed right. I tried reinstalling the Azure SDK, upgrading to Visual Studio 2015 but neither worked. I finally had to change the following line in my app.config:

    <system.diagnostics>
<trace>
<listeners>
<filter type="" />
</listeners>
</trace>
</system.diagnostics>


to

    <system.diagnostics>
<trace>
<listeners>
<filter type="" />
</listeners>
</trace>
</system.diagnostics>


Notice the change from "2.7.0.0" to "2.5.0.0". For me, Microsoft.WindowsAzure.Diagnostics 2.7.0.0 DLL did not exist. Reverting back to 2.5.0.0 works fine. I'd still like to find the root cause but I have more important things to move on to. Hope this helps!

Error : Could not load file or assembly or one of it's dependencies , Yeah!!! I found a solution for this terrible error First of all Thanks for every one who tried to help me Here's my solution Right Click on the  Check the list of Dll's in the output folder. Make sure all needed dll's are present. Try to check the properties of 3rd party or non .NET framework assembly to have the "Copy Local" set to "True".

Adding to Sandrinio's answer (sorry I don't have privilege) I had a similar error where 1.7.0.0 was being referenced but this section in my web.config pointed to version 1.0.0.0

<system.diagnostics>
<trace>
<listeners>
name="AzureDiagnostics">
<filter type="" />
</listeners>
</trace>


I commented it out and the problem was resolved.

[Solved] Could not load file or assembly (dll file), So it works if I change in the c# project from Any CPU to x86(all dlls are compiled in WIN32) from Properties -> Build -> Platform Target. Could not load file or assembly ‘[assemblyname]’ or one of its dependencies. An attempt was made to load a program with an incorrect format. No fear, though, as this is usually easily fixed. In quite a few cases, it’s simply a mismatch between architectures and easily changed.

It might be best to check the properties of Microsoft.WindowsAzure.Diagnostics to see which version you're using. Mine says 2.8.0.0 when I plugged that into the Web.config element mentioned by Dan and Taylor above it worked. 2.7.0.0 didn't work for me 2.8.0.0 did but tomorrow it may be otherwise ;-).

Could not load file or assembly 'xxx' or one of its dependencies error , The system could not find the 'Episerver.Forms.Core' assembly file to load. There are some workarounds for this issue: The dll file may not be in  I am getting an error when I run a build on the windows server with Visual Studio 2017 community edition installed. Could not load file or assembly 'Microsoft

I looked at the references and discovered that Microsoft.WindowsAzure.Diagnostics is used by the roles. In my case, the roles were using 2.8.0.0. I then opened the app.config of each role and set the add for Microsoft.WindowsAzure.Diagnostics to that same version.

  <system.diagnostics>
<trace>
<listeners>
<filter type="" />
</listeners>
</trace>
</system.diagnostics>


Could not load file or assembly, Could not load file or assembly. Back in the days .NET tried to solve the so called DLL Hell with its GAC and versioning. It more failed than succeeded in doing  ' Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ' I am using Visual Studio 2017 and was trying to do Update-Database after Add-Migration. To resolve the issue I closed Visual Studio and re

Fixing the "Could not load file or assembly or one of its , This post describes how to fix the “Could not load file or assembly '[​assemblyname]' or one of its dependencies. An attempt was made to load a  This was the solution for my MSTest not finding tests [MSTest][Discovery] Failed to discover tests from assembly Reason:Could not load file or assembly 'System.Reflection, Version=4.1.1.0 etc – Dan M Dec 5 '18 at 15:58

Resolution: Error "Could not load file or assembly 'file://\\server\path , "Could not load file or assembly 'file://\\server\path\file.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT:  Exception occurred while initializing the installation: System.BadImageFormatException: Could not load file or assembly 'file:///C:\_PRO DUKCIJA\Debug\DynamicHtmlTool.exe' or one of its dependencies. An attempt was ma de to load a program with an incorrect format..

"Could not load file or assembly" error when you compile a SDK , Could not load file or assembly 'file:///C:/Windows/assembly/GAC_32/Interop.SAF​/8.0.0.0__31bf3856ad364e35/Interop.SAF.dll' or one of its  Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bc111e9429c' or one of its dependencies. The system cannot find the file specified. As per my application requirement, I need to use Excel file from Office 2007 to 2013. I have referred few StackOverflow links but I am not getting result. I am stuck.