-1

How do I reference a DLL in a C# script? I'm not using Visual Studio, I'm just using NPP with a C# plugin to write a quick one file script. That script needs to reference a third party DLL. Is there a code snippet that I can include to accomplish this?

The DLL I want to reference is for iTextSharp

Frantumn
  • 1,725
  • 7
  • 36
  • 61
  • You say you're using "a C# plugin" - *which* C# plugin? That's what will determine what you need to do... – Jon Skeet May 22 '14 at 18:31
  • The NPP plugin is calle CS-Script I don't think it can manage DLLs though. – Frantumn May 22 '14 at 18:40
  • @Frantumn I removed my answer because it seems like some people won't understand it, but it's not true it should be a comment, because I pointed out that C# isn't a scripting language and I provided you a scripting alternative, if you were looking to script using .NET. – Matías Fidemraizer May 22 '14 at 20:18

2 Answers2

0

You can load the assembly dynamically from a file

Assembly.LoadFrom("iTextSharp.dll");
Pierre
  • 417
  • 3
  • 9
0

Now we know the plugin you're using, it's easy. Just read the documentation on "Using .NET assemblies". In particular, it sounds like you want:

//css_reference iTextSharp.dll;

That's assuming the library is one of the locations CSScript can find automatically - read the linked documentation for more information and options.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194