lundi 23 juillet 2018

Cannot load class from assembly

I have a dll file which contains following class.

public class UnityContainerConfig : IContainer
{
    private IUnityContainer _unityContainer;
    public UnityContainerConfig()
    {
        _unityContainer = new UnityContainer();
    }

    public void Register(HttpConfiguration config)
    {

    }
}

Now I want to load this class from assembly in another project.

AssemblyName assemblyName = AssemblyName.GetAssemblyName(path);
Assembly iocConfigurationAssembly = Assembly.Load(assemblyName);
Type configFile = iocConfigurationAssembly.GetType("UnityContainerConfig");

The assembly is loaded correctly but i received null value when i try to use GetType.





Aucun commentaire:

Enregistrer un commentaire