I've used the answers to Using the same modules in multiple projects to migrate some shared code to a .dll file for use in new projects. The shared code has a few methods, all of which use two NuGet packages some of which use 'Microsoft.Office.Interop' to be able to also work with outlook messages.
I've created a new project as a test bed for the new .dll file and think I've probably done something "the long way", as I've had to manually add the nuget packages to this new project to get it working, and when I use an overloaded method that can either accept a string or an outlook object (as below) I get the error Cannot find the interop type that matches the embedded type 'Microsoft.Office.Interop.Outlook.MailItem'. Are you missing an assembly reference?
Public Sub UpdateNextDesk(comment As String)
'code
end sub
Sub UpdateNextDesk(ByRef withMail As Outlook.MailItem)
'different code
end sub
Is there a way of compiling the dll so that it automatically adds the right references to projects that include it? or conversely a way of including the dll and all the references it uses? If I create more overloads for my methods that accept even more types of object, will I need to create a list somewhere of all the different references I need to add to new projects?