SDL Studio plugin system allows developers to develop new features on top of the standard functionality. There are 2 types of plugins that can be developed, one which behaves like a Studio add-in and another one which behaves as a standalone application. Both plugin types require to run inside Studio installation folder. This is because the public Studio SDK is using other assemblies that are located in Studio folder. While this is perfectly fine for add-in type plugins for standalone plugins this adds limitation on where and how you can deploy your application.
Why not GAC ?
Many developers have asked us to register Studio assemblies in GAC in order to solve the issue on where and how you can deploy your standalone Studio plugins. Having Studio assemblies registered in GAC means that those assembly can be shared across the entire system. Although registering assemblies in GAC might had seem to be a good solution there are many implications when doing it. The main reason why Studio is not using GAC is because of the following scenario:
GAC supports multiple version of an assembly. This means that when an assembly is updated to a newer version both versions will be saved. You might say that the old version should be removed, but this is not always possible since for example there are customers that have multiple version of Studio that are used on the same machine. Keeping multiple version of the same assembly will lead to unexpected behavior and errors from the application.
You can read more about why to avoid GAC here.
Got it ... no GAC, but we want solutions!
To solve this problem I've developed a small library called Studio AssemblyResolver. Basically every time an dll is not found in the current application location the library will look after the dll in the Studio folder. The library comes with 2 mechanism for looking after Studio folder but you can add your own resolve mechanism. If you are interested about more details please have a look here. The library is also published in the Nuget package repository which allows to be easily added to your project.
How to use Studio AssemblyResolver
There are 2 simple steps to get your Studio assemblies resolved:
Add a reference to the Studio.AssemblyResolver library from Visual Studio using NuGet
Add the following line of code in you application entry point
I've already included the Studio AssemblyResolver library in Reindex Translation Memories plugin. You can have a look here if you are interested to see how I've included the library.
Please leave a comment if you have any questions or feedback.