Following an example from this thread, I've made an application that dynamically loads in C# "scripts" (actually, plugins) into my game -- but I've hit a snag: how do I reference the assemblies for XNA when compiling? Can I even be sure the XNA assemblies will be around on the end-user's machine?
This line from the example:
options.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
Adds the referenced assemblies for my game only, not the XNA assemblies (for instance, for Vector3, Matrix, etc.). The only way to add the assemblies seems to be inlining an absolute URI to the necessary .dll
files.
EDIT: Looking at this thread I have discovered how to load all of the required assemblies:
foreach (AssemblyName assemblyName in executingAssembly.GetReferencedAssemblies())
cp.ReferencedAssemblies.Add(Assembly.Load(assemblyName).Location);
But apparently the XNA assemblies aren't included in this list for me :(