MY XNA game is finally complete, but I'm having difficulty getting it to run on other Windows computers. I've read similar other stackexchange topics here, here, and here, but I'm still gonna need help on the specifics of my particular program.

I'm using XNA 4.0 in Visual Studio 2010 on a Windows 7 Professional 64-bit machine. The game was done in C#. I've made release builds on my machine and they work great.

I don't care about Windows XP or Windows Vista. I'm only targeting Windows 7 and Windows 8, 32- and 64-bit. I could not get my game to run properly on them. The game always crashes at startup, either silently or with a crash message.

So I discovered that the ClickOnce publisher/installer will supposedly ensure that the prerequisites (such as .Net 4.0 and XNA Redistributable) get put on the target machine. However, I found that microsoft says here: "Also, the XNA Framework Redistributable file does not contain the Content Pipeline Build Runtime. Building content at run time is supported only when XNA Game Studio has been installed on the Windows-based development computer."

This leads to a problem. I'm pretty sure my game does in fact build content at runtime because there is only one music resource that loads different music files at different times. Here is the code.

public void scr_play_song(byte s)
    if (SEI_MSC != null)

    if (s == 1)
        System.IO.FileStream fs = new System.IO.FileStream(@"Music\msc01_Legend.wav", System.IO.FileMode.Open);
        TG.MUSIC = SoundEffect.FromStream(fs); // TG.MUSIC is a SoundEffect class

        SEI_MSC = TG.MUSIC.CreateInstance(); // SEI_MUSIC is a SoundEffectInstance class
        SEI_MSC.IsLooped = true;
        SEI_MSC.Volume = vol_music;
    else if (s == 2)
        // same stuff for other music files, etc

However, I could be mistaken, so: is this actually building content at runtime? Or is it just loading/streaming into an already-existing resource?

Before you ask, yes I'm using .wav files for music because .mp3 files are proprietary that charge an absurd license fee ($2,500 last I checked). Sadly in addition, I cannot let my .wav music files be normal resources that turn into .xnb files, because they total over 300 MB, which is too big of a download. Therefore, my installer will come with ogg vorbis files that then get decompressed into .wav files.

(BTW ive come across "solutions" where you can get .ogg natively working in XNA, but they were some real "hack" jobs in my experience and I have serious concerns that such "solutions" will add another layer of incompatibility.)

If someone has a better idea how to go about music, please let me know.

OK so now let me list all the references in my game:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Storage;
using System.IO;

And from the References tree in my game project, there's also:

Microsoft.Xna.Framework Microsoft.Xna.Framework.Avatar Microsoft.Xna.Framework.Game Microsoft.Xna.Framework.GamerServices Microsoft.Xna.Framework.Graphics Microsoft.Xna.Framework.Net Microsoft.Xna.Framework.Storage Microsoft.Xna.Framework.Video Microsoft.Xna.Framework.Xact mscorlib System System.Core System.Net System.Xml System.Xml.Linq

(I may need to remove some of these tho. I can't imagine where Framework.Video came from cuz i'm not using any video files at all. I've also heard bad incompatibility things about Framework.GamerServices. My game does NOT use the internet at all.)

Based on this list, can someone confirm that the only things my target machines will need are .Net 4.0 and XNA Redistributable?

Besides loading music at runtime, the only other "special" thing my game does is read/write to a file for the purposes of saving level progress. Here's the code:

    public void scr_load_progress()
        if (File.Exists("Progress") == false)

        LevelData = File.ReadAllLines("Progress");

        for (int i = 0; i < ASZ; i += 1)
            LevelDones[i] = LevelData[i].ElementAt(0) - '0';

    public void scr_save_progress()
        File.WriteAllLines("Progress", LevelData);

My game does not do anything else "special" as far as I know. It does not use the internet at all.

There's one more undesirable thing about ClickOnce publishing. It looks like I can't insert my own EULA (the legal agreement you have to accept) in it. This is why I'm using InnoSetup and would prefer to continue with it. I suppose I could use both and just let the Inno Installer call the setup.exe from ClickOnce, but that still doesn't get me around the other issue about building content at runtime.

At this point, I've considered moving this game to Mono or MonoGame (i have no idea what the difference is), but my deadline is fast approaching and I've never touched Mono and have no idea how difficult it will be to port my game. Plus i've already come across Mono topics about similar troubles with exactly what prerequisites are needed on target machines and how to get them installed.

Sorry for the many paragraphs but there were a lot of specifics I needed to list. I hope someone can help. To summarize:

Does my music code actually build content at runtime, or does it just load/stream?

Based on my list of references, will a ClickOnce setup.exe ensure the necessary prerequisites are installed?

Thanks in advance. I really miss the good old days where programs only ever called external .DLLs so you could just copy them in the same folder as the .exe, which has the added benefit of letting the developer (and user) easily see EXACTLY what dependencies there are. Oh well.

  • \$\begingroup\$ There are a couple of things wrong with your question. The .net 4.0 is a requirement for windows 7 so its already installed on every windows 7 computer. The Using statement, is only a keyword for the programmer. For example, instead of saying System.Boolean you can type Boolean inside your program. What you are trying to say is References (screenshot). There are external .dlls, like Microsoft.Xna.Framework.Game.dll, nothing has changed. If you don't have XNA installed, you dont have the required .dlls by default. \$\endgroup\$
    – dimitris93
    Apr 5, 2015 at 12:26
  • \$\begingroup\$ @Shiro thx i updated that and added a bit more info. I hope my gripe about DLLs did not go amiss. I have a feeling that even if we copy over Microsoft.Xna.Framework.Game.dll (and all other XNA dlls) to the target machine, it still wouldn't work because it needs a XNA framework installer that does stuff to registry keys and who knows what else in addition to copying the dll files. \$\endgroup\$
    – DrZ214
    Apr 5, 2015 at 12:41
  • 1
    \$\begingroup\$ The .dll is already compiled code, so I suppose we could call it assembly. Its just a few classes and functions. I see no reason why it wouldn't work if you reference those .dlls manually from your game's folder rather than the XNA install path. Even though I haven't tried it before. \$\endgroup\$
    – dimitris93
    Apr 5, 2015 at 12:46
  • \$\begingroup\$ When you say "reference those .dlls manually from your game's folder", do you mean just copying them in or would i hafta edit project properties and maybe some code? That does sound promising, but even if this worked we would come to an even harder question: is it legal to distribute microsoft's XNA dlls bundled with a game that I'm selling? \$\endgroup\$
    – DrZ214
    Apr 5, 2015 at 12:54
  • \$\begingroup\$ I am trying it right now for Monogame, cause I am curious myself. I ll try XNA too. \$\endgroup\$
    – dimitris93
    Apr 5, 2015 at 12:55

1 Answer 1


The following worked for Monogame. You can copy the .dlls to your game folder (the content folder is probably a better choice), then reference them and delete the old references, like I do below. You can take the exact same logic and apply it for Microsoft.Xna.Framework.dll, and every other Xna related .dll you are referencing. For Xna, all the .dlls are in this path for me C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\.


I copied the game folder, double clicked the .exe and my game opened on a fresh installed windows 7 64-bit computer.

  • \$\begingroup\$ thx im gonna test this as soon as i get the chance, but it brings up legal questions. Is it legal to distribute Microsoft's XNA dlls with a game that i'm going to be selling commercially? \$\endgroup\$
    – DrZ214
    Apr 5, 2015 at 14:34
  • 1
    \$\begingroup\$ @user1705043 Well I am not a lawyer and I can't be sure, but I don't think there is something wrong with it. I could be wrong. Why don't you use Monogame if that concerns you that much. Its literally the same code. Unless you have done something complex in 3D where it is not implemented in Monogame. It is super rare though. \$\endgroup\$
    – dimitris93
    Apr 5, 2015 at 14:39
  • \$\begingroup\$ wow i am stunned. I installed MonoGame, made new project and added new classes, then just copied/paste all the code from those classes, then copied the content folder and my custom music folder into the new directory...and it works flawlessly... This has never happened to me in all my experience with Microsoft. \$\endgroup\$
    – DrZ214
    Apr 5, 2015 at 17:02
  • \$\begingroup\$ Not yet cuz i hafta reboot to the other OS's and i wanna thoroughly test the MonoGame version on my development machine first. However, i noticed something kinda odd. First of all, the references tree in the project solution only has 3 things: MonoGame.Framework, System, and System.Xml, but my code still has a lot of "using Microsoft.Xna.Framework;". I tried changing them to "using MonoGame.Framework;" but got errors, so idk if its really free of XNA references yet. Another thing i noticed was that sound effects tend to be truncated at the end. \$\endgroup\$
    – DrZ214
    Apr 5, 2015 at 18:04
  • \$\begingroup\$ This is how it is supposed to be. The .dll name is MonoGame.Framework and you are using Microsoft.Xna.Framework;. Its just a file name. They kept Xna naming for code maintainability. \$\endgroup\$
    – dimitris93
    Apr 5, 2015 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .