MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

Could not load file or assembly 'MaterialDesignThemes.Wpf, PublicKeyToken=null'

Open GorelH opened this issue 10 years ago • 7 comments

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

GorelH avatar Jun 26 '16 20:06 GorelH

Do you have .NET 4.6.1 installed?

SCKelemen avatar Jun 27 '16 01:06 SCKelemen

@SCKelemen Yes, it's a part of others projects, all using .NET 4.6.1

GorelH avatar Jun 27 '16 10:06 GorelH

Did you install from Nuget?

SCKelemen avatar Jun 27 '16 11:06 SCKelemen

Yes

GorelH avatar Jun 27 '16 14:06 GorelH

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 Card into UserControl1
  • Add UserControl1 into MainWindow
  • Compile, run > it fails

Why?

Take a look at the bin folder, the .dll's aren't copied over:

image

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);
        }
    }

ButchersBoy avatar Jun 29 '16 07:06 ButchersBoy

The solution above will copie MaterialDesignThemes.Wpf.dll but not MaterialDesignColors.dll have to copy manually. Thanks

GorelH avatar Jun 29 '16 21:06 GorelH

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

Arshad8464 avatar Jul 05 '18 13:07 Arshad8464