Getting the UDF Directory Pathname

In my Excel Services UDF, is there a way to determine what the pathname of the directory the UDF dll was loaded from

Answer this question

Getting the UDF Directory Pathname

  • Sweeps78

    Try

    System.Reflection.Assembly.GetAssembly().CodeBase.Location

    Or something under the Assembly reflection node should give it to you if that doesn't.

    - Luis



  • DarkFire2

    Did the answer above work out for you

    If not please let us know so we can try and continue helping, otherwise, please mark it as the answer for the thread so we can get it off the radar.

    Thanks!!



  • Kzin

    I need some more help as this is new to me.

    I'm using VB.NET and need the path in my New() method of my UDFClass().

    How do I set an Assembly variable to the instance of the assembly

    And what do I pass as the type parameter (required) to GetAssembly()

    Thanks!


  • Neotech

    Here's the solution from C# for anyone else who needs to do this:

    strin udfpath;

    udfpath = System.Reflection.Assembly.GetAssembly(this.GetType()).CodeBase;

    It returns a URL of the form: file:///C:/dir/subdir/file.ext


  • Getting the UDF Directory Pathname