在部署和另一臺計算機上註冊.Net
Excel.dll
,我試圖在VBA
編輯器中添加參考DLL
時得到一個錯誤Can't add a reference to the specified file
。C#DLL出類拔萃 - 不能添加到指定文件的引用 - regasm
我在Visual Studio
運行我的機器Windows 7
和Office 2010
細創造C#
的Excel.dll
。在我的計算機上編輯Excel VBA
編輯器時,沒有任何問題。我的問題是部署在運行Vista
和Excel 2007
的另一臺計算機上。我複製DLL到這臺電腦,並使用regasm
註冊該DLL。
任何人都可以指向正確的方向嗎?這裏是代碼和regasm:
C:\ WINDOWS \ Microsoft.NET \框架\ 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";
}
}
}
只是添加到我的帖子上面 - 我得到了報告「無法添加引用」錯誤,並且(如果我使用CreateObject而不添加引用)「許可證不可用」錯誤。 – Loophole