Could not load file or assembly exception

前端 未结 13 1996
情书的邮戳
情书的邮戳 2020-11-30 09:51

Any thoughts on what might be causing this exception?

I have a webservice proj, when i load the link i get

Could not load file or assembly \'I

相关标签:
13条回答
  • 2020-11-30 10:03

    I had this issue, when trying to use 64-bit .dlls in my ASP.Net project, in Visual Studio 2013.

    The solution was to click on Tools\Options, and tick this box:

    0 讨论(0)
  • 2020-11-30 10:07

    What worked for me was to add the assembly to GAC. To do that I ran gacutil -i PATH_TO_ASSEMBLY from Visual Studio Command Prompt

    0 讨论(0)
  • 2020-11-30 10:10

    My Error fixed, with change of build option to:

    in my C#.net win project:

    Properties > Build > Platform Target > 'x86'

    I accidentally change its value to 'Any CPU' and forget to change it.

    0 讨论(0)
  • 2020-11-30 10:11

    If I had to take a guess, it is either a) not finding the interoped assembly or b) the COM DLL is not registered in the local registry. Simply copying DIB to the /bin folder is not enough when you are monkeying with COM.

    I believe (B) is the most likely answer to what is happening.

    0 讨论(0)
  • 2020-11-30 10:15

    I had the same issue on Visual Studio 2015 on Windows 10 x64. I was already compiling in Any CPU mode. This was a default MVC4 application (nothing added). I found a simple solution over here that worked for me: https://github.com/aspnet/Home/issues/524

    In VS 2015: Tools > Options > Projects and Solutions > Web Projects > Use the 64 bit version of IIS Express for websites and projects

    0 讨论(0)
  • 2020-11-30 10:17

    BadImageFormatException usually means 64 vs 32 bit conflict. One of the assemblies is set to a specific platform i.e. 64 bit or 32 bit while the other is set or defaults to a different one. Check if both assemblies are for the same platform, preferably "Any CPU". In other words it could be that a 64 bit assembly is trying to load 32 bit one or vice versa.

    This also applies if you're calling a COM or a DLL which is compiled for different platform, for example you call 32 bit COM/DLL from an assembly on a 64 bit system where assembly's platform would default to x64. In this case adjust your assembly's platform to match.

    To change platform go to project Properties -> Build -> Platform.

    0 讨论(0)
提交回复
热议问题