Click here to Skip to main content
15,393,377 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have a problem with my app; When I make the normal debug inside Visual Studio it goes well, when I build the solution it also works well too, now, the problem is, when I build the setup file, I install it on my own computer, when I run it for first time it goes as well as debug mode, but after 20 minutes or more time without opening it, then it says: "C:/Users/myusername/Documents/Visual Studio 2013/Projects/myProjectname/project_SETUP/debug/myApp_SETUP.exe is not a valid win32 application".

I've been one whole week trying to solve this problem and nothing happens 'til today.

Additional Info.:

Made with C# in Visual Studio 2013, .NET Framework 4.5, Debug in Any CPU(also tryed just for x86)
My computer is a 32-bit OS (x86) with NET Frw 4.5, 4.0, 3.5, 3.0 installed.


Thanks in advance...


Well, thanks for all the people that helped me with this problem, though I finally ended with the conclusion of just copying and pasting my Project's Release Folder in the Program Files folder of another computer and it worked nicely and properly!!
Updated 26-Nov-14 11:38am
PIEBALDconsult 17-Nov-14 19:50pm
Didn't you ask that yesterday?
ChrisCreateBoss 17-Nov-14 21:07pm
nope. I saw a person who asked a similar question but it wasn't me.
Sergey Alexandrovich Kryukov 17-Nov-14 20:27pm
What do you mean by "Debug in Any CPU"? What do you deploy, targeted to AnyCPU or not? How is the development system different from target system?
Does the installation work for the development system?
ChrisCreateBoss 17-Nov-14 21:06pm
Yes, it is targeted to Any CPU on both development system and target system.
Sergey Alexandrovich Kryukov 17-Nov-14 21:21pm
Not a correct answer. What could it possibly mean "targeted to Any CPU on both development system and target system"? You either deploy one version of another one. "Target" is the property of the project, or its build...
This small element of doubt, even if it's just your phrasing, leave me unsure.
ChrisCreateBoss 18-Nov-14 12:14pm
Sorry I made mistake, I was thinking in another problem, my app is targeted to debug on AnyCPU, nor to development system.
Sergey Alexandrovich Kryukov 18-Nov-14 15:45pm
No problem; I just explain what makes me feel unsure about the problem. But, overall, I think there is not enough information.
ChrisCreateBoss 18-Nov-14 15:49pm
So tell me what do you need to know
Sergey Alexandrovich Kryukov 18-Nov-14 15:52pm
Well, I know next to nothing; I don't even know what this myApp_SETUP.exe should do. You need to know something, not me.
ChrisCreateBoss 18-Nov-14 15:54pm
myApp_SETUP.exe is the setup file that I built from Visual Studio. I put "myApp" instead of the real name.
Sergey Alexandrovich Kryukov 18-Nov-14 18:06pm
You know, this is not about the name...
ChrisCreateBoss 18-Nov-14 18:28pm
You are saying what is the app for?
Sergey Alexandrovich Kryukov 18-Nov-14 18:45pm
I said what I said: I don't know what it is doing. The name suggest it does setup. But it may mean very different things. Do you have different MSIs for different architectures? Note: MSI cannot be "Any CPU" (I consider it as a defect of Windows Installer, which was created before adventure of .NET)...
ChrisCreateBoss 18-Nov-14 18:52pm
The setup file was the one created by Visual Studio at adding new project > Visual Studio Installers > Setup Project...

That is the file that installs my main windows form in the OS.
Sergey Alexandrovich Kryukov 18-Nov-14 22:28pm
I just want to know what it does. (No, I don't use this trash, Visual Studio Setup Project, it is not even quite legitimate thing, technically; that's why Microsoft removed it from later version of Windows. I advise open-source WiX, which is really integrated with MSBuild and Visual Studio (yes, Visual Studio Setup Project template is not integrated with MSBuild).)
I can explain why there is a concern. MSIs don't have "Any CPU", as I explained before. They target certain instruction set architecture. So, I don't know how your *Setup*.exe is targeted to. I don't know how do you know that everything is "Any CPU". Can you see the point?
ChrisCreateBoss 19-Nov-14 9:28am
Yes, I know that not everythingis built in "anyCPU", just my windows form build target is on anyCPU.
Sergey Alexandrovich Kryukov 19-Nov-14 11:53am
But as you say, your *SETUP*.EXE does not run, not your target application.
ChrisCreateBoss 19-Nov-14 13:44pm
No, no, the setup runs correctly, it does its proper work, my TARGET APPLICATION is the one that gives me error but just when the SETUP has installed it. Do you understand?
Sergey Alexandrovich Kryukov 19-Nov-14 13:55pm
But, if so, how could I understand "C:/Users/myusername/Documents/Visual Studio 2013/Projects/myProjectname/project_SETUP/debug/myApp_SETUP.exe is not a valid win32 application" you quoted. It clearly tells me that "myApp_SETUP.exe" could not be executed. That's why I was asking what "myApp_SETUP.exe" does.
ChrisCreateBoss 20-Nov-14 14:36pm
I don't know too what it does, the main windows form is named LiveChat.exe, but the error quotes that is LiveChat_SETUP.exe the invalid win32 app, otherwise, the main app does not run properly too, I tried with the unhide all files option, but there is not a ghost file in there. Did I answer clearly?
Sergey Alexandrovich Kryukov 20-Nov-14 16:20pm
Yes. Now, you need to keep investigate on the application; and myApp_SETUP.exe is well screwed up, so re-doing it with WiX will pay off...
Note that it doesn't say "not valid .NET assembly", it says "not a valid win32application". By the way, did you check up the compatibility of your target .NET version and the version on the target system?
ChrisCreateBoss 20-Nov-14 16:58pm
Yes, I'm sure it says "Not a valid win32 application".

When I created the project(Windows Form Application), I chose .NET Framework 4.5, and in my Form's properties it says Target Framework: 4.5, so I think it is fully compatible, since I didn't touch anything else.
ChrisCreateBoss 20-Nov-14 17:14pm
I already built an installer with WiX just a few minutes ago and I get this error: "Undefined preprocessor variable '$(var.LiveChat.TargetPath)'"
Well, I didn't use an unreferenced variable, probably you did... :-)

Suppose you have a project in the solution, called, in this case, LiveChat. If you reference this project (add a reference to your WiX project) as project reference ("Projects" tab in the "Add Reference" window), this variable becomes defined. It has a property TargetPath. It is set to the output directory of that project, depending on the Configuration (and/or Platform). This way, you automate the directory path where you get files to put in your MSI...

ChrisCreateBoss 19-Nov-14 13:48pm
But I have a more efficient idea, I will delete the setup project from my solution, now, give me the instruction on how to make an installer with WiX.
Sergey Alexandrovich Kryukov 19-Nov-14 14:04pm
I'm not sure that the idea to give up getting to the root of the problem can be more efficient. But yes, dealing too much with Visual Studio Setup project would be a waste of time. We just don't know even what exactly is failing — please see my previous comment.

So, I answered on the use of WiX, but first, just build your application properly and copy it directly to the target system. If it doesn't work, it would not be worth installing. :-)

Besides, think why would you need installation at all. It's only need when you need to clearly uninstall the application; in case you modify system registry (register file types), firewall settings and the like. If you don't do changes on the system, you don't need installation.

tgrt 17-Nov-14 23:51pm
This stinks of an overzealous anti-malware program.
brianriggan 18-Nov-14 14:40pm
I agree this is similar to what I was seeing running windows 8.1 with the "smart shield" enabled.
Richard MacCutchan 18-Nov-14 3:47am
Check your antivirus and system logs. Also look at the properties of the exe file to see if something has changed it.
ChrisCreateBoss 18-Nov-14 12:12pm
I already did a scan, the result: no viruses, trojans or malwares found. I did a scan with RegCure Pro to see if something was going wrong with the Registry and it didn't find any problem. But thanks for the suggestion.
Richard MacCutchan 18-Nov-14 13:10pm
Well, for some reason your program is getting corrupted so you need to do some further searching - it could be anything on your system.
ChrisCreateBoss 18-Nov-14 13:22pm
Yeah, but I have been searching in other forums and I found a guy that had a similar problem, he didn't solve the problem at last, but I'm sure that there is a solution for it, something more I forgot to say in the main description of the question: if I build the solution and then send the app.exe to desktop(as shortcut), it runs well without being corrupted, but if I build the SETUP file, install it, and then send the app.exe to desktop again, it gets corrupted after 20 mins. or more! I think that the file that corrupts my app.exe is the setup.exe.
Richard MacCutchan 19-Nov-14 3:07am
You are wasting your time. You need to stop searching forums, and start doing some proper investigation on your system. This is not a simple programming issue that we can help you with. There is something happening on your system (who knows what) that is corrupting your file, either the anti-virus, a real virus, or something else that you are doing.
brianriggan 18-Nov-14 14:37pm
What OS are you running?
ChrisCreateBoss 18-Nov-14 14:50pm
Windows 7
brianriggan 18-Nov-14 15:16pm
Probably not the issue I am thinking of but I had problems when "Smart Screen" was enabled but that was on a Windows 8.1 machine.
ChrisCreateBoss 18-Nov-14 15:26pm
So what do you suggest to fix my problem?
brianriggan 18-Nov-14 15:30pm
I do not believe that Windows 7 has smart screen so that is not it. I think that tgrt was correct in his assertion that it is a Malware/Antivirus issue. Try enabling logging when you run the install then examining/posting the error from the log file.
ChrisCreateBoss 18-Nov-14 15:44pm
You want me to post here what the log file says?
brianriggan 18-Nov-14 15:51pm
Yes not the entire thing just what you suspect is causing the error.
ChrisCreateBoss 18-Nov-14 15:54pm
ok, wait a second...
ChrisCreateBoss 18-Nov-14 16:12pm
I doesn't give me any error, it installs correctly. But then the .exe gets corrupted.
brianriggan 18-Nov-14 16:22pm
Unplug the machine take it outside and throw it on the ground. Just kidding can you post a screenshot of the error? (Referring to posting a screenshot of whatever is telling you that it is corrupted.)
ChrisCreateBoss 18-Nov-14 16:36pm
How can I post a screenshot here? Sorry I'm new in CodeProject. :D
brianriggan 18-Nov-14 16:38pm
You know I have not ever actually done so. I would assume you could post a link to one of the free image sharing sites might want to get an admins input on that though. I have been a creeper for years but rarely ever posted.
ChrisCreateBoss 18-Nov-14 16:41pm!iQQQQT7b!S7XixcCc7WqgJOX4eFhMAcMYsNwjfvRFT_XMFNgl-wE

(Sorry for the language, but my PC is on Spanish language)
brianriggan 18-Nov-14 16:49pm
Cannot view this at work will try and look tonight sorry.
ChrisCreateBoss 18-Nov-14 16:55pm
Ok, no problem.
Richard MacCutchan 19-Nov-14 3:04am
That was a bit pointless, as it does not provide any more information than you have already given.

Try to install your application on a "clean" system you control - do you have a vm-infrastructure for testing? From all that comments and your explainations it seems your system itself is somehow missbehaving - I would rule that out as a next step by doing the install (and if that doesn't help) also the build on a "fresh" reference system. Do you have a build-server (or a coworkers pc) you could use?
ChrisCreateBoss 19-Nov-14 11:33am
Yes, I have VMWare Fusion with Windows 8 on an Apple Computer. I will try to make that. Thanks for your help.
ChrisCreateBoss wrote:

But I have a more efficient idea, I will delete the setup project from my solution, now, give me the instruction on how to make an installer with WiX.
Using Wix is much better idea than Visual Studio Setup project template. I tried to explain it in my past answers:
Custom setup project[^],
How to conditionally install components based on processor architecture type (32-bit or 64-bit)?[^],
installshield and Visual Studio 2012[^].


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900