Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Using Nuget packages for WPF when running as plug-in

$
0
0

I have a problem with loading external resources into a WPF application. The WPF app should run as a plugin for a 3rd party program. I believe it is irrelevant which program it is, but in this case it is about Autodesk Inventor.

My project structure is as follows;

  • One WPF class library
  • One testing app, which is a WPF application which just shows the main window and hooks into the process so for developing I can test without restarting Inventor the whole time.
  • One plug-in class library, this gets loaded by the program.

Basically the test-app and the plug-in setup code are identical. Only in the plug-in there is some logic that hooks the main window to a control in the inventor interface.

Everything works fine as long as I don't use any external packages. I want to use some packages to make my life easier. But as soon as I use some control from example MahApps, and I run the plug-in project, I get a FileNotFound exception for the package DLL. The DLL is present in the output directory though.enter image description here

Because my wpf class library does not have an app.xaml, I am importing the resources in the MainWindow.

Initialization code:

    public void InitializePropertyEditor(){    AppHost = Host.CreateDefaultBuilder()        .ConfigureServices((hostContext, services) =>        {            PropertyEditorServices.ConfigureServices(hostContext, services);        })        .Build();    AppHost.Services.AddViewModelLocator();    AppHost.Start();    // create window    var mainWindow = AppHost.Services.GetRequiredService<MainWindow>();    mainWindow.WindowStyle = WindowStyle.None;    mainWindow.ResizeMode = ResizeMode.NoResize;    mainWindow.Visibility = Visibility.Visible;    var helper = new WindowInteropHelper(mainWindow);    helper.EnsureHandle();    var hwnd = helper.Handle;    propertyWindow = GetDockableWindow();    propertyWindow.DisabledDockingStates = DockingStateEnum.kDockBottom | DockingStateEnum.kDockTop;    propertyWindow.AddChild(hwnd);    HwndSource.FromHwnd(hwnd)?.AddHook(WndProc);    // perform initialization    var initService = AppHost.Services.GetRequiredService<IInitializationService>();    initService.Initialize();}

I really have no clue why it will not work. Any ideas?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>