warning MSB3391: does not contain any types that can be unregistered for COM Interop

前端 未结 3 1827
灰色年华
灰色年华 2021-01-11 15:37

I\'ve made a simple C# DLL (that\'s part of a much larger project) using VS2005. I need to use the DLL in Excel via VBA code so I am using COM Interop on the assembly. I a

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-11 15:54

    In the AssemblyInfo.cs file, make sure you have the following:

    // Setting ComVisible to false makes the types in this assembly not visible 
    // to COM components.  If you need to access a type in this assembly from 
    // COM, set the ComVisible attribute to true on that type.
    [assembly: ComVisible(true)]
    

    UPDATE:

    Read: How can I make use of .NET objects from within Excel VBA?

    Which links to: http://richnewman.wordpress.com/2007/04/15/a-beginner%E2%80%99s-guide-to-calling-a-net-library-from-excel/

提交回复
热议问题