Friday, November 22, 2013

Adding external assemblies to load with Visual Studio at startup

Needed to add user defined methods for Telerik Reporting to be able to call the methods in expression builder of report, then it was necessary that Visual Studio loads the assembly at startup to make it ready for Telerik Report designer in VS.

Looked into VS configuration file:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe.config

Found the probing tag points to PublicAssemblies & PrivateAssemblies:
<probing privatePath="PublicAssemblies;PrivateAssemblies;..."/>

The above paths allows to have access to assemblies other than GAC, in this case, I needed to drop the custom coded assembly in a path which is known for VS.

Also assemblies deployed in PublicAssemblies path appear in the Add Reference dialog box, if you don't like to make them available in the Add Reference list but be known for VS, it should be deployed in PrivateAssemblies path.

Simply found the paths as following:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies

in this special case, I added the following parts in devenv.exe.config

<configSections> ... <section name="Telerik.Reporting" type="Telerik.Reporting.Configuration.ReportingConfigurationSection , Telerik.Reporting , Version=7.2.13.1016 , Culture=neutral , PublicKeyToken=a9d7983dfcc261be" allowLocation="true" allowDefinition="Everywhere"/> </configSections>

and then added the following part in devenv.exe.config to introduce the external methods functionality to Telerik.Reporting designer.
<Telerik.Reporting> <AssemblyReferences> <add name="MyAssembly" version="1.0.0.0" /> </AssemblyReferences> </Telerik.Reporting>

Now VS loads the assembly and it gets available for Telerik.Reporting as extended methods inside designer.
Share/Bookmark

No comments: