Licensed component does not work well with DI design

We licensed some third-party email components and developed a set of components for our system that uses them. These components are then loaded dynamically at runtime by the IoC container.

However, we recently noticed when testing on a non-developer machine, because the main .EXE that "hosts" our components does not reference and does not include .licx for third-party email components (separation of problems and all this), which leads to License verification of third-party email components failed.

Anyway?

This seems to be a pretty big flaw in the entire LicenseManager, .licx etc.NET license?

Thank!

+3
source share
2 answers

Licensed files are similar to configuration files - you can create libraries that link to them, but in the end there is an artifact that must live on the disk with the executable file.

I assume that you have a .licx file and just do not want to reference it in any way from the application project. You can avoid this by including the .licx file in the installer - it gets to the disk in the right place, and the application project is not wiser.

0
source

LicenseManager , Validate ( ".licenses" ).

. , LicenseManager , ..

    string assemblyPath = Assembly.GetExecutingAssembly().Location;
    AppDomainSetup appSetup = new AppDomainSetup();
    appSetup.ApplicationBase = new FileInfo(assemblyPath).DirectoryName;
    var newDomain = AppDomain.CreateDomain("NewDomain", AppDomain.CurrentDomain.Evidence, appSetup);
    var myClassInstance = (MyClass)newDomain.CreateInstanceFromAndUnwrap(assemblyPath, typeof(MyClass).FullName);
    myClassInstance.myMethod("foo");

, "MyClass" ( , AppDomains) MarshalByRefObject.

0

Source: https://habr.com/ru/post/1765802/


All Articles