Reputation: 48437
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
.
Upvotes: 0
Views: 475
Reputation: 4216
You have to use the full name, including the namespace.
From msdn entry for Assembly.GetType Method (String):
The name parameter includes the namespace but not the assembly.
Upvotes: 1