Visual Studio Extensibility: How to control the loading order of components?
See the question and my original answer on StackOverflowYour package offers a logging service. Visual Studio has a full infrastructure for this: How to: Provide a Service
What you need, in the package code, is therefore to:
create some interface that represents the service contract (like
IMyLogger
for example)register this service (this will eventually go in the registry at setup time so VS knows in a static way your package implements this)
[ProvideService(typeof(SMyLogger))] public sealed class EntrianInlineWatchPackage : Package {. . .}
implement the service (follow the link above for more).
In all other packages or addins or extensions that will use this service (so in your Tagger code), you should be able to get a reference to this service, for example:
IMyLogger logger = ServiceProvider.GetService(typeof(SMyLogger)) as IMyLogger;
and, magically, Visual Studio should load the package, if needed (thanks to the registry settings declared through the ProvideService
attribute).
PS: Note this will require that you define IMyLogger
in an assembly accessible by both the Package and the Tagger assemblies. Or you could use a well known interface that suits your need.