首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#DLL的相关有关问题 大侠入

2012-05-27 
C#DLL的相关问题 大侠入用C#生成了DLL文件,C#代码如下:using Systemusing System.Collections.Genericus

C#DLL的相关问题 大侠入
用C#生成了DLL文件,C#代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace LeonQtp
{
  public class Qtp_Msg
  {
  public static int MessageBoxL(string Msg, string Caption)
  {
  MessageBox.Show(Msg, Caption, MessageBoxButtons.OKCancel);
  return 0;
  }
  }
}

###############################################################################################
上述代码生成的DLL,可用C#调用成功
但是在QTP中,用下面语句调用失败:
Set CSharp_Msg = DotNetFactory.CreateInstance("LeonQtp.Qtp_Msg","C:\Leon\New\LeonQtp.dll")
 Ret = CSharp_Msg.MessageBoxL("Call by DotNetFactory!","by DNF obj")

Error如下:
Could not load file or assembly 'file:///C:\Leon\New\LeonQtp.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

大家帮忙看下吧~~~

[解决办法]
降到2.0肯定可以,刚试过
[解决办法]

热点排行