Context:
Windows XP
C#
Visual Studio 2010
XSL stylesheet
Problem:
I need to reference my own assembly (dll) in XSL stylesheet. I use <msxsl:assembly href="C:\my.dll"/>, but I gives me an error and doesn't work.
Solution:
I need to add my.dll to GAC (Global Assembly Cache) and reference it the XSL with <msxsl:assembly name="MyDLL"/>
To add it to GAC, I need to use the gacutil.exe, but before I do that, I have to sign my dll. In VS 2010, I open up my project and open up properties. Under the "Signing" tab, I check the box "Sign the assembly" and I "Choose a strong name key file." I create a <New> key and rebuild my project and dll. After that, install it to GAC by running gacutil.exe /i My.dll. I get the success message "Assembly successfully added to the cache." That's it. Now, I can simply reference it by name.
I can check it by running gacutil.exe /l My.dll. It returns "My, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7814e2fbc22d6551, processorArchitecture=MSIL"
If using the name alone in your XSL doesn't work, you can use this whole name above.