C# 32bit project under 64bit windows - c#

I'm working on a form application, I use plenty of hardware, Wiimote, USBjoystick and serial port. It all worked fine under 32bit windows, but I had to upgrade to 64bit for some other apps I'm working on.
I did some research and it is possible to develop x86 apps under x64 system, but now I don't know if this is what I want. The trouble maker is obviously directX sdk. AFAICS another option is, to install a virtual x86 machine specificly for developing this app (I don't want dual boot). I've never used this before, so I'm kinda worried that all this hardware won't work under virtual machine.
I'm using wiimoteLib and blueSoleil to connect bluetooth. So will this work. And do I use windows 7's virtual xp option, or a different virtual machine software? I'd probably use winXP as a virtual OS.

32 bit applications run perfectly fine on 64 bit operating systems. I have lots of my applications developed for 32 bit and they run without any issues in 64 bit. As you say you have lots of hardware used we can't be sure which may work or may not work.
best solution is to run your app in 64 bit and see if anything is not working (I am sure 95% will work) and then come back here with specific questions.

Inside IIS (7) click on Application Pools.
Find the Application Pool that is configured for your web application in the list.
Select it, then click Advanced Settings on the right.
Second setting in the list: Enable 32-Bit Applications - must be set to True.

When compiling your application in Visual Studio, try setting the target platform to x86 rather than "any CPU" (Project options/build/target platform).

I had the same problem running a 32 bit app on a 64 bit development computer. On VS 2010 I had to go to Properties/Configuration Manager/New and choose x86. Then I did a clean and rebuild and it ran fine.

Related

Blank Windows Feature list when loading through C#

I want to be able to open the "Windows Features" menu in my C# application, but for some reason, it'll show a blank Windows Features list, but only on some machines. I've ran this on another Windows 7 VM and it worked perfectly fine, but when doing this on my machine (and my friends machine), it left us with a blank list.
Here's the code I use to open "Windows Features". If I run this with CMD manually it works files however - only in the C# application will it cause problems.
Process.Start("OptionalFeatures.exe");
The same problem will happen if I use this as well
Process.Start("control.exe", "appwiz.cpl,,2");
Any ideas on why this is happening..?
Try specifying a platform target corresponding to your OS platform.
I assume the computers that run into this problem are 64 bit machines and your application runs in 32bit mode. So try specifying either platform target = AnyCpu AND disable the checkbox "prefer 32 bit" or set the platform target to 64bit.

Winform application crashs on WINDOWS 7 -64bits

I have a huge problem on one of my winform application. Someone who use my application works on windows 7 64bits and apparently it directly crashes when the application is launching.
My application works correctly on :
-Windows XP
-Windows Vista
-Windows 7 (32bits).
I developped the application on Visual C# express 2005 (.NET 2.0).
I am wondering if there is anything I can do to recompile my application to make it work on windows 7 64bits.
I am sorry, I have no access to the computer of the person (so I can't check, exception or anything like that). I am pretty sure that this issue is known that's why I'm asking you right now.
Does anyone have an idea ?
Thank you by advance for your Help
Regards,
Joze
In project properties setting window, select tab Build and change Platform target to X86. Republish..
EDIT: to the down-voter
By doing this Windows will know your program is designed for X86 use and will install it accordingly. (I've done this with Clickonce, and it works..)
Likly you use some interop x86 DLL or COM object. Try setting for your executable Target Platform x86 (not Any CPU as it is by default).
Do you use any unmanaged (com) components in your application?
If so, most likely you're including the 32bit version. If that's the case, you will have to compile 2 different versions of your program, one including the 32bit components, and the other including the 64bit components.
If that's not the case, it means you're using some platform specific code somewhere. More details about your application could help clarify the problem.

C# Crash on x64

I have a DLL created in VS 2008 and written in C#.
The dll project builds with the "Any CPU" flag.
When it is deployed and run on a Dell/Intel Windows 7 x64 machine it starts up OK, but it crashes when it tries to start using cryptography -- TDESAlgorithm.CreateDecryptor();
This is part of the mscorlib.dll.
I've built the app as targeting x64, but it also crashes in the same place. It runs fine on 32 bit machines.
How can I get this to run successfully on x64?
I ran into similar problem with windows services created in .NET. It was throwing exception and the Windows log file indicated errors in mscorlib.dll and kernel32.dll (if I remember correctly). No external 32 bits dll or special codes was used, only plain .NET.
The solution I got is to compile as x86 and then run it (as 32 bits) application on the 64 bits machine. This could be a solution as long as you don't need 64bits to run your app.
The solution I got is to compile as x86 and then run it (as 32 bits)
application on the 64 bits machine. This could be a solution as long
as you don't need 64bits to run your app. - Gaël Mo
I'd just like to point out that compiling and running for x86 on a 64 bit machine is NOT an answer... Joe would like to know why its crashing in x64 mode... obviously running in x86 mode works on x64 machines. If you couldn't get your car to run with a certain after-market part, would you consider it a valid answer if I told you to simply run the car without the part in it? Obviously not... Think carefully about your answers before posting them ok?
Does it run on the x64 machine if you build it for x86? If so, they
something isn't 64-bit ready. – sgmoore
I agree... I'd like to add that if you do not have the source code (you probably don't) then you are out of luck I'm afraid... I found THIS article that explains more fully... Apart from that, you may need to look into a different DES decryption library... OpenSSL/SSH perhaps?

How to run .Net Win-Forms application on a 64 Bit OS?

I have made a .Net win-forms application in C#, on a 32 bit OS (Windows 7).
It doesn't work on the deployed client-terminal/machine which has a 64 bit OS (Server 2008).
What should I do?
Thank you.
Go to the Build tab of the project's properties and make sure the platform target is set to x86. (This is just my first guess based on the vague information provided. The problem might be caused by something completely else, e.g. the terminal server environment as such.)
You should only change this setting if you need your application to address a large amount of memory or you definitely want to make sure it runs as a 64-bit process.
The AnyCPU setting can hardly be recommended as it may cause you all sorts of pain with respect to native dependencies (I'm not saying it should never be used, but it should be very well considered whether the additional overhead required for deployment and testing is worth the trouble).
Probably you have used some feature that is not available while running the app in x64. Change the build configuration to x86.
If it does work now, you have used some libraries (COM, ActiveX, Office 2007, WinAPI, ...) that does not like to be called from 64 bit.
If it works now, ask yourself: why do I want my app to run using x64 bit? What do I gain? Does it really need to use that much memory?
There is no problem with running a x86 bit app on a x64 bit platform.
If you are using ActiveX controls inside your application or anything else that is not portable to x64, you might have to change the build target to "x86".
If it's a genuine x86 application your x64 environment shouldn't have any problem running it. So make sure all your libraries and your own binary are x86 compatible and don't use x86 exclusive features like specific COM libraries.
You should ensure that you project is being built with the "Any CPU" platform.
The default is sometimes to build for "x86".
Check your build config. I think VS will default to building the app for x86 platforms if you develop in a 32-bit environment. Either change to x64 or AnyCPU, rebuild and try again.
.stompp

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
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?
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.

Categories