Main WPF project cannot find the WPF control Library dll unless netloaded by AutoCAD

Main WPF project cannot find the WPF control Library dll unless netloaded by AutoCAD

ilovejingle
Enthusiast Enthusiast
895 Views
2 Replies
Message 1 of 3

Main WPF project cannot find the WPF control Library dll unless netloaded by AutoCAD

ilovejingle
Enthusiast
Enthusiast

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 ? 

 

 

0 Likes
896 Views
2 Replies
Replies (2)
Message 2 of 3

jtoverka
Advocate
Advocate
Message 3 of 3

genosyde
Advocate
Advocate

do you know .bundle folder in acad concerned Auto-Load

if you so, this post will be useful for you.

https://forums.autodesk.com/t5/net/dll-in-plugin-bundle-fail-to-be-autoloaded/td-p/8344111

 

netload command is so hard to debug making program.

 

0 Likes