Main WPF project cannot find the WPF control Library dll unless netloaded by AutoCAD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In order to reuse my wpf project, I have created a wpf control library. this compile to the first a.dll
<UserControl x:Class="Stair_Creator_Lib.stair_view"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Stair_Creator_Lib"
mc:Ignorable="d"
d:DesignHeight="210" d:DesignWidth="320">
....
</UserControl>
I also implemented some button and AutoCAD login in this WPF control library.
Then In my main project, I have created a WPF window using the WPF control library
<Window x:Class="BGS_Acad_Tool.Views.stair_window"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BGS_Acad_Tool.Views"
xmlns:sta="clr-namespace:Stair_Creator_Lib;assembly=Stair_Creator_Lib"
mc:Ignorable="d"
Title="stair_window" Height="210" Width="320">
<sta:stair_view/>
</Window>
all the buttons/ textboxes are show correctly in the window. then in my main program, I try to create the window and show it.
[CommandMethod ("TEST")]
public void cmdTest()
{
var win = new stair_window();
Application.ShowModalWindow(Application.MainWindow.Handle, win);
}
This complied to the second b.dll, I have referenced a.dll in the main function. Everything compiled and build correctly
When I run AutoCAD, if I only netload b.ll, and run the "TEST" command, it throws an exception :
Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll
Additional information: Could not load file or assembly 'Stair_Creator_Lib, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
If I netload a.dll and b.dll , it works as expected. Why this is the behavior? I have put both dlls in the same folder, why I still need to netload both of them in AutoCAD ?