Few days back, I was migrating my application for VS2008 to VS2010 and it was done successfully except some people started running the application. They faced the error as below
“Could not load file or assembly ‘PresentationCore’ or one of its dependencies. An attempt was made to load a program with an incorrect format. ”
I tried to diagnose the problem and tried to find a solution.<!–more Continue reading… –>
So whenever you upgrade to VS 2008 to VS 2010 and also upgrade ASP.NET version to 4.0. And if your website hosted on IIS, when you open your VS 2010 IDE it prompt a message asking to upgrade to asp.net version to 4.0. When you say yes it upgrades the version at IIS.
So let’s come back to our original problem. When I diagnosed I found the machine was having 64bit OS.
And at IIS, there is setting “Enable 32-bit Applications” at application pool level that is by default set false . So if you are having 64 bit OS and your application target 32-bit applications then this property must be true.
So how to set it. I have included the images for IIS7. So first you need to know, which application pool your virtual directory points. So to check this
Goto -> cmd prompt -> type inetmgr -> click on your virtual directory and click on basic settings
Now you can see the Red oval that that is the name of Application pool set for this directory.
Now click on Application pool-> Click on DefaultAppPool -> and click on Advance settings.
Here you can see Red oval, I have set Enable 32-bit Applications to true. Now restart the IIS.
Now run your application and it must be working.
Thanks for your article which saved my time.
Glad to hear that 🙂
Glad to know that you liked it..