Link to home
Start Free TrialLog in
Avatar of jetbet
jetbetFlag for New Zealand

asked on

C# "... is not a valid Win32 application"

I am trying to run an Application created using VS 2010 on a Win 7 64bit system and get the above error.
At first I thought it must be the project not targeting "anyCPU" but this has proved not to be the case.
I have tried running other applications (created with VS) on the machine and get the same error.
Other applications (VIZ engine, VLC, etc all run fine on the machine.

Could a corrupt .Net installation cause the error to be generated?
Avatar of Brendan M
Brendan M
Flag of Australia image

What versions of .NET are installed?
Which Version of .NET is the project targeting?
Avatar of jetbet

ASKER

.NET 4.5.1
The applications starts on another machine (same specs etc) also with only 4.5.1 installed.
Try recreating the application and try again. maybe it's corrupted on that computer and not the other one.
Avatar of jetbet

ASKER

I have upgrade my environment to VS 2013 and rebuilt the application. It still only works on the test machine with the same OS, dotNET, etc.

One clue is that dotNet applications that do not use a .dll seem to be fine on both machines.
do you use interop or pinvoke in your application?
Could you please check your Windows EventViewer for Runtime Failure entries?
Avatar of jetbet

ASKER

I have checked the event viewer but there is nothing to show the issue.

I do not believe I use pinvoke or interop.
Avatar of jetbet

ASKER

After I transfer the files all the .dlls are missing the File Version, Product Name, Product Version, Copyright etc. values from the properties.
When I try and start the exe I get a “… is not a valid Win32 application” error and it will not start.
If I try and send the Zip file and extract it up there I get an error saying the zip file cannot be extracted because it is empty. This is the same zip file I used earlier to get the files I transferred, so originally it is fine.
If I unzip the files to the local test Viz preview machine, I have no problems and it starts fine.

I created a small Hello World application with a .dll and transferred these to the same machine, via the same VNC connection, and this started fine. The Version info etc. was also showing on this .dll.

I have even reinstalled the .Net Framework 4.5.1 on the target machine but this made no difference.
Could you please compile the whole solution as x86 and test it on the development and the  "problematic" machine?
Avatar of jetbet

ASKER

The solution is compiled by a 3rd party vendor.

Could you please advise what you believe the issue may be before I arrange this.
ASKER CERTIFIED SOLUTION
Avatar of jetbet
jetbet
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
so that version works fine on the "problematic" machine?
Avatar of jetbet

ASKER

Yes, it looks like it ws not the machine that was problematic but the transfer reaction with the files
Avatar of jetbet

ASKER

The answer I came up with is the reason for the error. As to what caused the corruption I will not know at this stage.