0

So I have created a little C# game using XNA and would like to be able to show it to a few people and therefore ideally send it to them. As they're not great with computers I'd like to just simply be able to send them and executable file which they open and automatically runs the game. When I go into the debug folder in my project I find the executable file of my game, however I can only double click and run the .exe when it is in that file. If I drag it out onto the desktop and try and run it, it doesn't open and then eventually I get an error pop up saying 'BouncingBallGame Has Stopped Working'.

Could anybody help me as to why this could be, or am I going about it the wrong way completely and do I need to publish the project in visual studio or something?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Rich
  • 15
  • 1
  • 9
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Dec 06 '13 at 00:58

2 Answers2

1

Your game will need two things to run:

  1. The appropriate .NET Framework to be installed on the target machine.

  2. To have its supporting files with it. You'll notice that in the debug folder that it's not the only file. The executable needs all of these files too.

System Down
  • 6,192
  • 1
  • 30
  • 34
  • Ahhh I see, I just tried copying the Debug folder to desktop and running it from that and it works. I guess I'll just have to send that folder instead then! Is there not a way to make it a completely standalone .exe then? – Rich Dec 06 '13 at 00:22
  • @Rich - Never had to do it, but ILMerge should do what you need plus embedding all of your resource files http://stackoverflow.com/questions/5017213/net-stand-alone-executable – System Down Dec 06 '13 at 00:25
  • @Rich - No problem. If you've found this answer to be helpful don't forget to "accept" it. Cheers! – System Down Dec 06 '13 at 00:33
  • I even copied debug folder to desktop and that too not working – Jitendra Pancholi Nov 05 '22 at 10:21
0

As mentioned by System Down

.exe file needs ..NET Framework to be installed on the target machine

& To have its supporting files with it.

or you can make a installer file of your project which will install your game into the host machine.

you can find a good Article here which shows how to build a installer file for your project.

Vivek Saurav
  • 2,235
  • 4
  • 25
  • 46