3

So I made a simple calculator console application with C# and Visual Studio. Now I gave the .exe file from my debug folder to a friend to test the application. Unfortunately, when he tries to open it, nothing happens.

I made him check if he had .Net Framework which he has. Also nothing on the task manager or anything. He says that simply nothing happens. I made the app to be run-able on AnyCPU. I tried running the application on my other computer which I could without a problem.

Also he has Windows 8, and has SmartScreen activated which of course popped up with an alert but he said that he forced it to run it, so I really don't know what is wrong. I hope you guys might know what's going on here.

  • 1
    You're probably missing a dependency of some sort. Check the application event log for errors; it should give you a direction to proceed. – Lynn Crumbling Jan 08 '13 at 18:32
  • Try building to a lower version of the .NET framework or publishing the solution as you said you only sent him the debug file –  Jan 08 '13 at 18:34
  • 3
    @raddry, Check the EventViewer for errors on the client machine, it should let you know what causes this problem. –  Jan 08 '13 at 18:34
  • 2
    How does your friend "try to open" the .exe? He says "nothing happens" but then says he "forced it to run"; those two statements contradict each other. Find out what your friend is doing before wasting more time on this. – Dour High Arch Jan 08 '13 at 18:36
  • @DourHighArch He says the first time he tried to open it, he said he foced it ( don't know how ) but nothing happened afterwards and now he disable SmartScreen and when he tried to open it it doesn't work either. Simply nothing happens. –  Jan 08 '13 at 18:48
  • Checked the Event Viewer, nothing. He still just tries to open the .exe and nothing happens... –  Jan 08 '13 at 19:17
  • @raddry Do you have anything going on in your Program.cs (or App.xaml.cs depending on type of app). Also are you 100% certain that there is no message at all in the Event Viewer (Application log) – Rudi Visser Jan 08 '13 at 19:35

3 Answers3

2

You cannot force SmartScreen, you must disable it (at least I had to.) Anyway compile with x84 (also 64bit architecture can execute this.*) What Framework are you targeting? Windows 8 has standard 4.5 installed, to run programs under 3.5 it must install .NET 3.5 (it should automatic popup)

Try to Release build instead of Debug. (Its at the top bar, enable Advanced Settings.)

*IA64 cannot execute it, AMD64 can. To change the architecture of the program: Go to Project, the tab Build, then you see Platform Target change it to x84.

To disable smartscreen: Windows + Q search for SmartScreen, you get 'Maintenance Center', on the left click 'Change Windows Smartscreen Settings' then select the last radiobutton.

I translated everything roughly, it could be called different in English

joell
  • 141
  • 5
  • Indeed I do have Windows 8 as well and disabled SmartScreen, I think I remember that you couldn't force it to run an application but my friend told me he was sure about it. I'll ask him to disable it and tell the results in a few mins. –  Jan 08 '13 at 18:37
  • According to (http://msdn.microsoft.com/en-us/library/ff602939.aspx) .NET Framework 4.5 is backward compatible with previous .NET Framework versions. So, there should not be necessary to install the previous version of the .NET Framework. –  Jan 08 '13 at 18:38
  • 1
    @platon You need to add a framework to your apps config, to say it's okay on on a higher framework, otherwise the OS will insist that you install it. Should, doesn't mean it will work, it means it might not. :( –  Jan 08 '13 at 18:43
  • I thought its not backward compatible because I tried to open an application (which targeted on .NET 3.5) and it said that it was required to install .NET 3.5 (other versions of .NET are also installed at that install) –  Jan 08 '13 at 18:44
  • @raddry Can you tell me how your friend did that? (I'm almost sure that you can't 'force it'.) –  Jan 08 '13 at 18:44
  • the answer is a yes and no for backwards compatibility... see here http://msdn.microsoft.com/en-us/library/ff602939.aspx –  Jan 08 '13 at 18:47
  • If by 'force it', you mean bypass it to run the application, hit More Info and then Run Anyway. – Rudi Visser Jan 08 '13 at 18:54
  • He disabled SmartScreen, I built it in x86 also downgraded the .NET and still nothing. –  Jan 08 '13 at 19:17
  • @raddry What do you mean with downgrading? Have you tried to use the Release config? Also RudiVisser Didn't know that, thank you for letting me know. –  Jan 08 '13 at 20:21
0

I had similar issue with moving EXE files to a different machine.

I did a bunch of searching and it ended up being that the new machine (that the EXE didn't work on) didn't have the most recent (or maybe not at all) Microsoft Visual Studio C++ Redistributable files.

I simply went to The latest supported Visual C++ downloads and installed the newest vc_redist for my machine. The EXE worked just fine immediately after that.

MarianD
  • 2,716
Matt S
  • 1
0

I had the same problem when I copied the .exe file (Debug or Release) to another machine and it would simply not work! Showed up in task manager for a few seconds and would disappear leaving only an ArgumentOutOfRangeException and a Kernelbase.dll error in the application event logs. So I decided to install Visual Studio on the machine where the file would not launch. After copying the project folder to a different file structure than on the original machine and hitting compiling it, I found out that I was trying to cut a string (file path) shorter than it was (due to different file structure). So the problem was in the code itself and NOT in any .dlls or .NET versions. Hope I have helped!