Could not load file or assembly 'xxx' or one of its dependencies. An attempt was made to load a program with an incorrect format

前端 未结 9 617
情歌与酒
情歌与酒 2020-11-27 12:29

I just checked out a revision from Subversion to a new folder. Opened the solution and I get this when run:

Could not load file or assembly \'xxxx\' or one

相关标签:
9条回答
  • 2020-11-27 12:48

    inetmgr then come to Application pool->Advanced setting of your pool-> will have the option "Enable 32-Bit Applications" set to true; and restart IIS. check again.!

    0 讨论(0)
  • 2020-11-27 12:53

    Make sure you verify your setting for "Prefer 32-bit". In my case Visual Studio 2012 had this setting checked by default. Trying to use anything from an external DLL failed until I unchecked "Prefer 32-bit".

    enter image description here

    0 讨论(0)
  • 2020-11-27 12:54

    It's definitely an issue with some of the projects being built for x86 compatibility instead of any CPU. If I had to guess I would say that some of the references between your projects are probably referencing the dll's in some of the bin\debug folders instead of being project references.

    When a project is compiled for x86 instead of 'Any CPU' the dll's go into the bin\x86\debug folder instead of bin\debug (which is probably where your references are looking).

    But in any case, you should be using project references between your projects.

    0 讨论(0)
  • 2020-11-27 12:54

    In my case It worked by going to project Properties and under Target Framework i selected .NET Framework 4. This is because i have moved to a new machine that had other higher .NET frameworks already installed and the project selected them by default. See what target framework works for you.

    0 讨论(0)
  • 2020-11-27 13:06

    if while In visual studio with IIS express working and when published failed try this:

    0 讨论(0)
  • 2020-11-27 13:08

    If you get this error while running the site in IIS 7+ on 64bit servers, you may have assemblies that are 32bit and your application pool will have the option "Enable 32-Bit Applications" set to False; Set this to true and restart the site to get it working.

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