TheSwamp

Code Red => .NET => Topic started by: jtoverka on August 31, 2021, 05:25:05 PM

Title: WPF Resource Dictionary
Post by: jtoverka on August 31, 2021, 05:25:05 PM
Hello All,

I have an issue that popped up when I was separating code into respective libraries. I have a vs project called BasicWPF. Inside is a StyleDictionary for WPF XAML. I reference that resource dictionary elsewhere in other projects. I have applications that run outside of AutoCAD that run just fine.

The issue is when I run a project inside AutoCAD an Error pops up. It's pretty clear, a FileNotFoundException on BasicWPF, which is triggered from the ResourceDictionary reference in XAML. Now this BasicWPF is indeed in the project directory. I have another application in the same directory that references that dll and it runs just fine outside of AutoCAD.

Has anyone experienced this issue?
Title: Re: WPF Resource Dictionary
Post by: jtoverka on September 03, 2021, 06:47:56 AM
Should have looked more closely. Solution here:
http://www.theswamp.org/index.php?topic=54708.msg592308#msg592308 (http://www.theswamp.org/index.php?topic=54708.msg592308#msg592308)
Title: Re: WPF Resource Dictionary
Post by: helaman on October 06, 2021, 12:56:39 AM
Something similar happened to me.
You have to load the dll at the beginning of your command.
The dll has to be in the root folder.
Code - C#: [Select]
  1. Assembly.LoadFrom(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MaterialDesignThemes.Wpf.dll"));