3

I need to access objects from two projects of my c# solution within Word VBA. Below is my project structure. Each project has its own namespace.

Instead of the mentioned projects, there is another project called 'View' created using VSTO. 'View' project uses all other dlls. enter image description here

I need to access objects from 'Entities' and 'Server' projects and I have able to create the .tlb file for 'Entities' project using this way and this.

I am successfully using the Entities.tlb file currently. In order to create .tlb file for Server project, I have tried the same approach. Even the solution build is successful, no .tlb file is generating for the Server project.

Why the second .tlb file is not generating ? Are we only able to create .tlb files for one project within a c# solution?

What is the best approach to create objects of the C# solution with multiple projects to use within Word VBA?

ApsSanj
  • 549
  • 7
  • 23
  • Have you checked in the VBA object browser for the objects provided in the .tlb file. If all of your objects in the diagram above reside in the same solution then its likely they will be visible in the .tlb class in the VBA object browser. – freeflow Apr 16 '20 at 10:09
  • @freeflow Just checked, only the objects implemented under 'Entities' project are visible in object browser. – ApsSanj Apr 16 '20 at 10:27
  • 1
    Ok. I'm at the limit of my knowledge here. Your observation suggests that Entities is in its own solution or namespace. The only other straw I can clutch at is that the other objects have not been declared as public. – freeflow Apr 16 '20 at 10:45
  • @freeflow Yes, Each project has its own namespace, I have now modified the question to include this info. – ApsSanj Apr 16 '20 at 11:07
  • I was unable to find a way yet. I am currently using `RegAsm.exe`(in location "C:\Windows\Microsoft.NET\Framework64\v4.0.30319") to create tlb files using command `RegAsm.exe (dll location) /tlb /codebase`. Is there any risk associate with bundling those .tlb files generated using `RegAsm.exe` with the final shipping product instead of using tlb files generated from Visual Studio itself? – ApsSanj Apr 22 '20 at 04:06

0 Answers0