I've had a look at your project and get the same error.
I don't know what the mechanism is whereby .NET and WPF looks for and loads the extra assemblies like MaterialDesign.Wpf in this case.
I suppose there is some special load and search mechanism that does not go through the standard .NET assembly load paths.
However, you can pre-load the assembly into the right context by calling some code that uses the relevant types as soon as your add-in loads.
For example, you can add a class that implements IExcelAddIn, and use the AutoOpen to iniatilize the assemblies you need.
Then when you later make the WPF calls, the assemblies are already loaded and work fine.
I put some suggested code below.
-Govert
using System.Windows.Media;
using ExcelDna.Integration;
using MaterialDesignColors;
using MaterialDesignThemes.Wpf;
namespace ExcelDNATest
{
public class AddIn : IExcelAddIn
{
public void AutoOpen()
{
InitializeMaterialDesign();
}
public void AutoClose()
{
}
void InitializeMaterialDesign()
{
// Create dummy objects to force the MaterialDesign assemblies to be loaded
// from this assembly, which causes the MaterialDesign assemblies to be searched
// relative to this assembly's path or loaded from the packed add-in.
var card = new Card();
var hue = new Hue("Dummy", Colors.Black, Colors.White);
}
}
}