views:

77

answers:

2

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

+2  A: 

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?

Jon Skeet
+1: especially for this bit: "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"
Mitch Wheat
Missing 64bit mysql dll is most likely the culprit, as setting the target CPU in .Net only tells to which version of native code to bind to.
dvhh
i am using another application C# with directx in X86 it get failed in windows 7 64bit
ratty
@ratty: If you're using DirectX I wouldn't be surprised if that failed when running against the wrong architecture... but *most* applications should be okay.
Jon Skeet
in my visual studio i didnt find ANY CPU option so only i go with x64
ratty
@ratty: You may need to create a new build configuration. Which version of Visual Studio are you using, and which project type are you using? For your non-DirectX project I would still try using x86 unless you have a reason not to.
Jon Skeet
A: 

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.
Martin Liversage