Winform not working on 64 bit machine

SmashAndGrab
SmashAndGrab used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
did you register your assemblies?
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
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.
AndyAinscowFreelance programmer / Consultant

Commented:
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
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Author

Commented:
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

Author

Commented:
"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
AndyAinscowFreelance programmer / Consultant

Commented:
>>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.

Author

Commented:
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.
AndyAinscowFreelance programmer / Consultant

Commented:
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 MoreauSenior .Net Consultant
Top Expert 2016

Commented:
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?

Author

Commented:
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?
AndyAinscowFreelance programmer / Consultant

Commented:
>>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 MoreauSenior .Net Consultant
Top Expert 2016

Commented:
>>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?

Author

Commented:
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 ..
AndyAinscowFreelance programmer / Consultant

Commented:
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 MoreauSenior .Net Consultant
Top Expert 2016

Commented:
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?

Author

Commented:
Thank Eric -  Its this what you mean...

Screenshot from the SETUP project..

Author

Commented:
Program Setup screen

Author

Commented:
PreRequsites..
Éric MoreauSenior .Net Consultant
Top Expert 2016

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

Author

Commented:
Apologies..

References from project
Éric MoreauSenior .Net Consultant
Top Expert 2016

Commented:
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?

Author

Commented:
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 MoreauSenior .Net Consultant
Top Expert 2016

Commented:
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?

Author

Commented:
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

Author

Commented:
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
Senior .Net Consultant
Top Expert 2016
Commented:
probably (from what we can see from here) related to SAP. I would start by looking into this direction.

Author

Commented:
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.
AndyAinscowFreelance programmer / Consultant

Commented:
>>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.

Author

Commented:
Good idea Andy - thanks.

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


Will give the test a shot.
AndyAinscowFreelance programmer / Consultant

Commented:
>>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.

Author

Commented:
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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial