views:

387

answers:

2

Hi,

I have taken ownership of an application which is a .net win forms application which hosts a System.Windows.Forms.WebBrowser. When the application launches it makes a http request to load a xap file. I immediately see "install silverlight" icon and on clicking get: "Microsoft Silverlight cannot be used in browsers running in 64 bit mode".

The app was written initially on a 32 bit machine although I have a 64 bit machine.

Any ideas what I need to tweak to get this running?

JD

+1  A: 

Try running the application in 32-bit mode. If it helps you can change build configuration to x86 in visual studio so that the generated executable is always run in 32-bit mode.

If you build the application with 'Any CPU' option it's bitness will depend on the platform it is actually running on. On the other hand building it in '32-bit' mode makes sure that it will always run as 32-bit application.

Giorgi
Thanks, I checked the configuration options and all I saw was Any CPU. But clicking new created an X86 version and it all works now. I better read up on this.
JD
+1  A: 

The "bitness" of the machine on which a .NET application is build has no impact on the "bitness" of the final application. By default a .NET EXE will run in either 32 or 64 bits depending on the operating system it is running on at the time.

Hence on a 64bit system a typical .NET application will run in 64bit process. You can change that behaviour at compile time by changing the build options platform target to x86 to force the app to always run as a 32bit application.

This is probably what you will want to do if hosting a silverlight app is a critical or common thing you need to do.

There is also an SDK tool called "CoreFlags" which can use to tweak an existing .NET .exe to ensure it runs as 32 bit:-

CoreFlags.exe YourApplication.exe /32BIT+ 
AnthonyWJones