Weird error message when running my application - c#

Guys I created a console application in Visual Studio 2010. It targets the .NET framework 2.0. When I run the application is Visual Studio, it works perfect. I then exited Visual Studio and copied the executable to my C:\Windows\System32 directory. When I open a command prompt window and try to execute my program, it comes up with a standard Windows message box with an error that says "Unable to find a version of the runtime to run this application". I know I got the .NET framework installed.
I then copied the executable to my C:\Users\Public directory and tried to execute it from there and it worked fine. So I am assuming this is some kind of security issue or something? What do I need to do make the application work from C:\windows\system32 directory?
I am using Windows 7 64-bit, by the way. The application was compiled to target .NET 2.0 framework and 32-bit machines.

I think on a 64-bit machine you'll have to put it into c:\Windows\SysWOW64, which contains all the 32-bit stuff retained for compatability (everything in system32 should be x64).

Related

Unable to deploy CefSharp application

I'm trying to run my CefSharp application on a separate computer other than my development machine, but I'm unable to. I built it in Release for the x64 platform, and moved the entire contents of the build folder over to my other computer. I tried running all the executables in the build folder, but none of them would work; when executed, they would not appear on screen, and after some time a window would open up with the generic "this program has stopped working" windows crash dialogue. I tried installing the Visual C++ redistributable and the .NET 4.5 Framework, but it still wouldn't run afterwards. What am I missing?

Application.exe is not a valid Win32 application error

I have written a Console application that client is trying to run it on their Windows Server 2003 R2 machine machine and they get that error message.
If I go to Build -> Configuration Manager all my projects are set to Platform of "Any CPU" and Configuration of
"Release"
What else I might have missed? They don't want to actually run the console application by double clicking on it, they want to give it to the Windows schedules tasks so it can pick it up and rn it on certain times
Starting with .NET 4.5, the compiler generates an EXE that's marked to be compatible only with Windows version 6.0 and greater. Vista and up. Such an executable will fail to run immediately when started on XP and Server 2003, they are Windows versions 5.0. You get this error before it can tell you that .NET 4.5 isn't installed on the machine.
You must target .NET 4.0 or less. Same requirement on any DLLs you have a dependency on, including unmanaged ones. More about this in this post.

C# Windows forms app created using Visual Studio 2012 not working on windows xp

I have created a windows forms application using C#.net 4.0 on Visual studio 2012.
App works great on windows 8 and windows 7 but when I try to run the same app on Windows XP I get following error message.
Following are the prerequisites for my app:
1. .net Framework 4.0
2. Windows Installer 4.5
3. ReportViewer 2010
4. MYSQL DB 5.6
5. Visual Basic PowerPack 10
I have installed all these pre-requistes on Windows XP. My 1 click setup installs the application correctly but on application Start up I am receiving error.
I also tried upgrading visual studio 2012 and then rebuilding and publishing the app but still the same error persists.
Following is the screen shot from the Application Event logger
Screenshot from Project's configuration manager
Screenshot from Project Properties
Can anyone suggest me what could be the issue.
If your program icon (or possibly any icons used by your program) has any images that are larger than 64x64 pixels, you can get this error on XP (in System.Drawing).
Check all your icon files and ensure that none contain images larger than 64x64
You Need Service pack 3 for XP and check the EXE build whether it might build for X64 and also check your XP machine is having .Netframework 4.0 change that into AnyCpu and once again build
the EXE and check with XP. and change your framework as .NetFramework 4.0
Are you targeting Mixed Platforms/Any CPU/x86? Can you try different build configurations?
Are you referencing any third party DLL's?
Can you catch and log details of the exception, or does the program fail to execute entirely?
I've had strange issues before when compiling for Mixed/Any CPU, and x86 machines throw a wobbler if the program isn't specifically targetted to x86.

"setup.exe is not a valid win32 application" error on ClickOnce Setup

I have winforms applicaton. I created a setup using click once. My applicaton is build in .NET 4.0 and x86 as platform target. It works on my .NET 4.5 Win 7 64 bit machine but on a .NET 4.0 64 bit Win Server 2003 machine it gives the exception setup.exe is not a valid win32 application. I can only run the application via copying all the related files.
What may be the problem?
I removed the tick under "properties->publish->Prerequisities->Create setup program to install prerequisite components" and now it's working.

run successfully on development computer. But fail to load z3.dll when I run the packaged winform application on other computer

I have developed an win-form application using Z3 api for C#. The application can run successfully on the computer which I used to develop. But after I build a setup project with the "SETUP AND DEPLOYMENT" function in VISUAL STUDIO 2010. The packaged application cannot run successfully on computers other than the development computer. Error message: failed to load z3.dll when running. What should I do to solve the problem?
z3.dll is unmanaged dll which is used by Microsoft.Z3.dll. Sadly, you cannot reference it by Reference dialog in Visual Studio.
I guess z3.dll is missing in the installation folder where Microsoft.Z3.dll is present.
I suggest that you run the application (including z3.dll and Microsoft.Z3.dll in the same folder) on a new machine, and try to pack all necessary bits to an installation package when they run fine.

Categories