Could not load file or assembly 'MaterialDesignThemes.Wpf, PublicKeyToken=null'
Installed Material Design Themes through nuget in WPF control library. Then got this error when referenced it in a UserControl.
Could not load file or assembly 'MaterialDesignThemes.Wpf, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
My package.config :
<package id="MaterialDesignColors" version="1.1.2" targetFramework="net461" /> <package id="MaterialDesignThemes" version="1.5.0.523" targetFramework="net461" />
Any help is greatly appreciated
Do you have .NET 4.6.1 installed?
@SCKelemen Yes, it's a part of others projects, all using .NET 4.6.1
Did you install from Nuget?
Yes
OK, I just went through what I think was the same process as you:
- Create new WPF Project
- Add new WPF Control Library
- Install MD into the Control Library
Get-Project WpfControlLibrary1 | Install-Package MaterialDesignThemes - Add a
CardintoUserControl1 - Add
UserControl1intoMainWindow - Compile, run > it fails
Why?
Take a look at the bin folder, the .dll's aren't copied over:

Either reference the packages from your .exe, or do something like this to make the build process think the .dlls need to come over:
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
ShadowAssist.SetShadowDepth(this, ShadowDepth.Depth0);
}
}
The solution above will copie MaterialDesignThemes.Wpf.dll but not MaterialDesignColors.dll
have to copy manually.
Thanks
Same issue for me and i tried the above solution and it worked for MaterialDesignThemes.Wpf.dll but not for MaterialDesignColors.dll i even have the dll in bin folder . Is there anything i should add reference for MaterialDesignColors.dll in code like i did for MaterialDesignThemes.Wpf.dll ?? Its a class library project