【发布时间】:2012-09-10 21:45:20
【问题描述】:
在另一台计算机上部署和注册.Net Excel.dll 时,尝试在VBA 编辑器中添加对DLL 的引用时出现错误Can't add a reference to the specified file。
我在Visual Studio 中的C# 中创建了Excel.dll,它在我的机器上使用Windows 7 和Office 2010 运行良好。在我的计算机上的Excel VBA 编辑器中添加对 dll 的引用没有问题。我的问题是部署在另一台运行Vista 和Excel 2007 的机器上。我把dll复制到这台电脑上,用regasm注册了dll。
谁能指出我正确的方向?这里是代码和 regasm:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe excelDll.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace TestDll
{
[ClassInterface(ClassInterfaceType.AutoDual)]
public class Test
{
public string HelloWorld
{
get
{
return "Hello World";
}
}
public void sayGoodbye1()
{
MessageBox.Show("Say Goodbye");
}
public string sayGoodbye2()
{
return "Say Goodbye";
}
}
}
【问题讨论】:
标签: c# dll windows-vista excel-2007 regasm