1

We have an app the requires Full Trust because of a Chilkat .NET 3.5 DLL This has not been a huge issue, however we would like to submit our app to the: Windows Web Application Gallery and it must be Medium Trust.

So to make it medium trust all we need to do is

  • remove the reference to the DLL
  • comment out the methods that tie into that code

Rather than making 2 different versions of the app, what is the best approach to remove the reference to the DLL for one version of the app?

thanks!

aron
  • 2,856
  • 11
  • 49
  • 79
  • I understand this is a very old post, but I stumbled across the same problem, were you able to find a better solution to this problem? – Samuel Jun 25 '13 at 22:04

1 Answers1

1

That’s not a simple one, but my first thoughts on this would be to abstract it out with and interface and late bind it in, but you must remember to check you have full trust when you load it or it might not work.

static class Program
{
    static void Main(string[] args)
    {
        Assembly asm = Assembly.Load("ExampleAssembly, Version=1.0.0.0, Culture=en, PublicKeyToken=a5d015c7d5a0b012");
        IFullTrustAddin addin = asm.CreateInstance("Namespace.MyChilkatWrapper") as IFullTrustAddin;

        if (addin == null)
            return;

        addin.DoSomething();
    }
}

interface IFullTrustAddin
{
    void DoSomething();
}
Robert
  • 3,328
  • 2
  • 24
  • 25