【发布时间】:2011-10-02 01:13:29
【问题描述】:
我正在 XNA 中开发一款 RPG 风格的游戏,并且正在实施一个脚本引擎。
我遵循了一些教程来尝试使其正常工作。目前我从一个 XML 文件中读取了以下内容:
namespace MyGame
{
public class EngagedCode : ScriptingInterface.IScriptType1
{
public string RunScript()
{
ChangeFrame( 2 );
}
}
}
成功进入项目后,我尝试使用以下代码对其进行编译:
Microsoft.CSharp.CSharpCodeProvider csProvider = new Microsoft.CSharp.CSharpCodeProvider();
CompilerParameters options = new CompilerParameters();
options.GenerateExecutable = false; //DLL
options.GenerateInMemory = true;
options.IncludeDebugInformation = true;
options.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
CompilerResults result = csProvider.CompileAssemblyFromSource(options, code);
但是,此时我总是收到以下错误:
'result.CompiledAssembly' threw an exception of type 'System.IO.FileNotFoundException'
好像系统找不到我编译的.dll,不知道为什么。我不知道如何克服这个错误。有人有什么建议吗?
【问题讨论】: