我想创建对Excel程序集的引用并使用以下代码:
[Test]
public void ExcelTest()
{
Assembly current = this.GetType().Assembly;
Assembly excel = typeof(Microsoft.Office.Interop.Excel.Workbook).Assembly;
Assert.AreEqual(current.FullName, excel.FullName); // Why is excel the same as current assembly?
}
[Test]
public void MscorlibTest()
{
Assembly mscorlib = typeof(string).Assembly;
Assert.IsTrue(mscorlib.FullName.StartsWith("mscorlib"));
Assembly current = this.GetType().Assembly;
Assert.AreNotEqual(mscorlib.FullName,current.FullName); // As expected
}
为什么Excel与我的当前程序集相同?
获取Excel程序集的好方法是什么?
阅读文档时找不到我的愚蠢。