我正在尝试从QTP(使用vbscript)调用C# dll。我已经尝试了许多方法,但都没有成功:
- Visual Studio 2010
- 创建C#类库(st.dll)
代码:
using System;
using System.Collections.Generic;
using System.Text;
namespace st
{
public class Class1
{
public static int GetValue()
{
return 34;
}
}
}
regasm /codebase st.dll
- 失败,因为它不是有效的.NET程序集。
在QTP/vbscript中,我尝试了以下方法:
extern.Declare micInteger, "GetValue", "e:\st.dll", "GetValue"
- 返回消息:'无效的过程调用或参数'
无论使用哪种方法,我都非常感谢您能提供如何从.vbs文件中调用c# dll的任何见解。