Avatar of SmashAndGrab
SmashAndGrab
 asked on

Winform not working on 64 bit machine

Hi,

I have developed a windows application using (visual Studio).   I have just recently installed it on a 64 bit machine, it installed perfectly but when I try and run the application I get an error of something like :  ”The program cannot load”  (I havent got the 64 bit machine with me at the moment

My development machine is 32 bit so it runs perfectly fine on this so I am unable to debug.  

I am hoping that someone is able to offer some advice on this as all my users will soon be upgraded to 64 bit.

Thanks in advance.
C#Microsoft Development

Avatar of undefined
Last Comment
SmashAndGrab

8/22/2022 - Mon
p_davis

did you register your assemblies?
Éric Moreau

Is the correct .Net framework installed on this computer? have you deployed any references? Try to build a simple application that shows up a dummy form instead of a more complex application.
AndyAinscow

I guess you have a third party component that is 32 bit.  The default settings of the solution you compiled (any CPU) would make it run as 64 bit on a 64 bit machine - which then doesn't run because part of it is 32 bit.  If I am correct then you need to change the target to x86.

SNAG-0006.bmp
Your help has saved me hundreds of hours of internet surfing.
fblack61
SmashAndGrab

ASKER
Hi,

Thanks for the comments.

Here is what I have tried so far:

I have changed the build config to x86:

Compiled the program as an x86

But I still get the same error:

Error
SmashAndGrab

ASKER
"P Davis - did you register your assemblies?"

Apologies - I am fairly new to win forms - could you explain how I would do this please?

Thanks
AndyAinscow

>>But I still get the same error:

The error you show as a screen shot is very different than in the body of your question.  Please change it back to 'Any CPU' and confirm it is the same error.  If it is a different error please post a screen shot of that error message.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SmashAndGrab

ASKER
Hi Andy,

 I have just rebuilt the solution as "ANY CPU" and have reinstalled it on the 64 bit machine.

build
I can confirm it is the same error message.

Error
Sorry for any ambiguity about my original message - I should have really waited until I had access to the laptop before posting.

Apologies.
AndyAinscow

OK.  My comment and those by the other experts are most likely not relevant.  You have some problem after the app has been loaded and is running.
Éric Moreau

have you tried to build a simple application that shows up a dummy form instead of a more complex application.

Is the correct .Net framework installed on this computer? have you deployed any references?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
SmashAndGrab

ASKER
Andy - Is there a way of me finding out what the issue is?

Eric - I am currently in the process of creating a new simple project.

The 64 bit machine is a new build - not exactly sure what framework it will have  - probably whatever the latest one is.  
What do you mean about deploying references?  What do I need to do?
I normally just build the project - it then creates a setup.msi .

I then install the setup.msi on the machine.

This works perfectly well on 32 bit machines but when I install on a 64bit I get the above error.

of course, it may not be the fact that its a 64 bit - I'm guessing it could be anything.    

Hoping that someone can help?
AndyAinscow

>>Andy - Is there a way of me finding out what the issue is?

This sounds rather like a run time error.  They aren't so easy to track down.  
I'd follow the advice from Eric first, if it is something you need to install then get that sorted out first.
Éric Moreau

>>What do you mean about deploying references?

If you are using 3rd party controls/components, they need to be part of your .msi. Some, like Office, cannot be part of your .msi so it requires a separate installation.

Which OS have you installed? Which .Net framework is your project targeting?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SmashAndGrab

ASKER
Hi Eric,

Thank you.

I have created a new simple blank application (testApp.exe) and it runs without issue on the 64 bit machine.

I'm not sure if its a fair test as the original app has a setup.

The OS i use is Windows 7 SP 1.  See screenshot:

32 bit OS
The 64 bit OS also Win 7 SP1. See Screenshot:

64 bit
this is the .Net framework on the 64 bit machine:

64 bit ..
AndyAinscow

Have a look at your problem app and see what controls it uses.
Can you add one of each to this test app you now have and see if it still starts without problems.
Éric Moreau

So because your test application ran without issues (no matter how it is deployed), the problem lies in one of the references. What do you have under the References of your project? Are they all in your deployment package? Have you tried to take the Bin folder (debug or release depending on you build your final application) and copy it as-is to the 64-bits system just as a test?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
SmashAndGrab

ASKER
Thank Eric -  Its this what you mean...

Screenshot from the SETUP project..
SmashAndGrab

ASKER
Program Setup screen
SmashAndGrab

ASKER
PreRequsites..
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Éric Moreau

Not the setup project. What are the references under your application's project?
SmashAndGrab

ASKER
Apologies..

References from project
Éric Moreau

I see SAP in your references (and I am not used to it). What are the requirements to deploy SAP?

Have you tried to take the Bin folder (debug or release depending on you build your final application) and copy it as-is to the 64-bits system just as a test?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
SmashAndGrab

ASKER
Hi Eric,

"Have you tried to take the Bin folder (debug or release depending on you build your final application) and copy it as-is to the 64-bits system just as a test? "

Can you explain what you mean here?  I can test it when I know what you mean. :)

Thanks

Stuart
Éric Moreau

The result of the compilation is sent to the bin folder (debug or release). Copy the all the files in the same folder as your application .exe to the 64-bits computer (plain old copy - not install) and double the .exe from there. Is that working?
SmashAndGrab

ASKER
Hi Eric,

This folder:

BIN FOLDER CONTENTS
It is currently copying to the 64 bit machine as we speak.  

Will post results shortly.

Thanks

Stuart
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SmashAndGrab

ASKER
Hi Eric,

1.  I copied the contents of the BIN folder on my local machine to the MCRS folder on the 64 bit machine (c:\Program Files (x86)\MCRS\).


I still get the same error (see screenshot)

Error from 64 bit folder
ASKER CERTIFIED SOLUTION
Éric Moreau

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SmashAndGrab

ASKER
I think I have found the issue.  Its to do with the database that this application is using.  

It uses an Access Database and uses ODBC drivers.
AndyAinscow

>>It uses an Access Database and uses ODBC drivers.

Is the access a 32 bit or (hopefully not) a 64 bit version?  You could try changing to oledb drivers and see if that makes a difference.
You could make a small app that makes a connection to the DB, check that you can get that to run and then see if there is a difference in your settings between the two (test and real) apps.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
SmashAndGrab

ASKER
Good idea Andy - thanks.

Its 32 bit office.
What do you mean by changing the OLEDB drivers?


Will give the test a shot.
AndyAinscow

>>What do you mean by changing the OLEDB drivers?

You say you currently use ODBC.  I'm saying try it with OLEDB (very different) as well just as an alternative to see if that makes a difference.
SmashAndGrab

ASKER
I wished there was a way or giving you the application (its only 2mb) I bet you'd spot the problem in about 2 seconds! haha
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.