问题描述
我现在正在测试Script#,并使用单个类创建了一个简单的Script#类库.
I'm testing Script# right now and created a simple Script# class library with a single class.
该类的方法可以执行以下操作:
The class has a method that does something like this:
public static string[] SplitName(string name)
{
return name.Split(' ');
}
它可以很好地编译并生成JS输出文件,但是当我从NUnit项目中引用此程序集并尝试对其进行测试时,会抛出MissingMethodException.
It compiles fine and generates the JS output file but when I reference this assembly from my NUnit project and try to test it a MissingMethodException is thrown.
System.MissingMethodException : Method not found 'System.String[] System.String.Split(Char)'.
我在做什么错了?
推荐答案
请记住,即使它是有效的.net程序集,它也会引用自定义mscorlib.dll.请参阅我对另一个问题的回答,以了解我的处理方式.
Remember that even when it is a valid .net assembly, it references a custom mscorlib.dll. See my answer to your other question to see the way I do it. Is it possible to write code in C# and use Script# to share it between .NET assemblies and JavaScript?
这篇关于从另一个.NET程序集使用Script#程序集时,为什么会出现MissingMethodException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!