XNA game publishing help with incompatibilities via content built at runtime

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)
SEI_MSC.Stop();

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
fs.Dispose();

SEI_MSC = TG.MUSIC.CreateInstance(); // SEI_MUSIC is a SoundEffectInstance class
SEI_MSC.IsLooped = true;
SEI_MSC.Volume = vol_music;
SEI_MSC.Play();
}
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)
{
scr_save_progress();
return;
}

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.

• 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. Apr 5 '15 at 12:26
• @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. Apr 5 '15 at 12:41
• 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. Apr 5 '15 at 12:46
• 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? Apr 5 '15 at 12:54
• I am trying it right now for Monogame, cause I am curious myself. I ll try XNA too. Apr 5 '15 at 12:55

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\.
• 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. Apr 5 '15 at 18:16