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?

5
  • 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. Commented Apr 16, 2020 at 10:09
  • @freeflow Just checked, only the objects implemented under 'Entities' project are visible in object browser. Commented Apr 16, 2020 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. Commented Apr 16, 2020 at 10:45
  • @freeflow Yes, Each project has its own namespace, I have now modified the question to include this info. Commented Apr 16, 2020 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? Commented Apr 22, 2020 at 4:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.