ratty
ratty

Reputation: 13434

C# setup with x64 target Platform does not support in windows 7 64 bit OS

I am working with c# windows form application and i am using mysql as backend. i created setup for my project by giving target platform property as x64. when i install my application in windows 7 64bit OS it installed perfectly without error. but when i open the installed application it cant open ,its shows "Windows closing the application". what is the solution for my problem. Eventhough i didnt install mysql driver.

I have another c# windows form application with DirectX without have any backend, this application also have same problem

Thanks in Advance

Upvotes: 2

Views: 3081

Answers (2)

Martin Liversage
Martin Liversage

Reputation: 106826

Chances are that the source of your problem is that you application is running as a 64 bit process but it has some dependency on a component that is only available in 32 bit. This is not unexpected when you depend on DirectX. MySQL I'm not so sure about.

When you build your project you decide which platform you want to target. You do that in the settings for your project in Visual Studio.

  • Right click on the project the in solution explorer and select Properties from the menu. It is important that you right-click on the project that creates your application and not for instance a setup project.
  • On the left side of the window displaying the settings you have some tabs. Select the second tab named Build.
  • There is list box named Platform target. This is where you determine what platform to target.

You have four choices:

  • Any CPU: If you choose this your application will run as the "native bitness" of your host operating system. On 64 bit Windows your application will run as 64 bit. Do not select this if you have a dependency on a component that is only available in 32 bit. If that is the case and you select this your application will run fine on 32 bit Windows but will fail on 64 bit Windows. That is the symptom you are experiencing.
  • x86: If you choose this your application will always run in 32 bit. Select this if you have a dependency on a component that is only available in 32 bit.
  • x64: If you choose this your application will always run in 64 bit and will refuse to run on 32 bit Windows. That is probably not what you intend.
  • Itanium: This is for another processor architecture.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1500504

Here are the diagnosis steps I'd go through:

  • Check the event log. If the CLR has failed to load your application to start with, there may be something in there.

  • Try using the Fusion Log Viewer to see what's happening in terms of assembly binding.

  • Does the MySQL driver you're using have separate 32 and 64 bit DLLs, and are you sure you're installing the right one?

  • Are you able to test this without going through a full installation (i.e. build and run on a Win7 x64 box without the installer part)?

  • Does it still fail if you build for "Any CPU"? Or is there some specific reason why you can't do that?

  • Does it fail if you build for x86, which should still work fine on an x64 box? (Unless you really need to take advantage of lots of memory in your app, there can be some performance benefits to running the x86 CLR, particularly in terms of memory as every reference is half the size.)

  • If you create a small "test app" which doesn't use MySQL, does that fail?

  • Can you write a tiny console application which does use MySQL, and make that fail, thus showing a minimal amount of "user" code required to provoke the failure?

Upvotes: 2

Related Questions