I'm creating a scripting engine for my game, and I need C# scripts to have the Microsoft.XNA.Framework assembly referenced so that I can inherit from my own classes.
Currently, I error when I add a reference to Microsoft.XNA.Framework.dll. This is my reference adding code (I've left out the reference to my own EXE, but it is there.):
parms.ReferencedAssemblies.Add("System.dll");
parms.ReferencedAssemblies.Add开发者_JAVA百科("Microsoft.Xna.Framework.dll");
parms.ReferencedAssemblies.Add("Microsoft.Xna.Framework.Graphics.dll");
parms.ReferencedAssemblies.Add("mscorlib.dll");
And here is my code to be compiled:
using System;
using Microsoft.XNA.Framework;
using Microsoft.XNA.Framework.Graphics;
namespace _2342 {
namespace Blocks {
class MyClass : Block
{
public MyClass() {
_name = "TestBlock";
}
}
}}
I get two errors from the CodeProvider saying that neither of the XNA DLLs can be found.
How can I fix this?
You have misspelled the assembly name 'Microsoft.XNA.Framework'. It should be 'Microsoft.Xna.Framework'
This might be related or have relevance. When i did that for my scripting engine it choked since XNA is in the GAC. Therefore i had to do something like this
ReferencedAssemblies.Add(@"C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.dll");
with "C:\Program Files (x86)\Microsoft XNA" being the install path of my XNA dlls.
精彩评论