0

I do have a UserControl (works) which I would like to use in a WPF project. When I run the application I get following error

Unable to load DLL 'VCECLB.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

This is a C++ dll and if I add it under references it goes to the project folder like this:

enter image description here

I also add it in the output folder \bin\x64\Release but without success. What I am doing wrong here? Any feedback would be highly appreciated!


UPDATE:

The XAML for loading the UserControl looks like this:

<Window x:Class="WpfApplication1LL_Neu.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:lowLightGrab="clr-namespace:LowLightGrab;assembly=LowLightGrab"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <WindowsFormsHost Height="290" HorizontalAlignment="Left" Margin="16,10,0,0" Name="windowsFormsHost1" VerticalAlignment="Top" Width="475">
        <lowLightGrab:UserControl1/>
    </WindowsFormsHost>
</Grid>
</Window>

Thanks

Norick
  • 271
  • 5
  • 20
  • http://stackoverflow.com/questions/7793780/how-to-use-c-dll-in-c-sharp-project – Amit Jan 21 '15 at 08:22
  • you tried this? http://stackoverflow.com/questions/27902842/unable-to-load-dll-in-wpf-c-sharp-application – Ebenezar John Paul Jan 21 '15 at 08:31
  • @Ebenezar yes it helped in the way that the VCECLB.dll has been found and loaded. Therefore the UserControl seems to work but there is (still) one issue that the designer is not loaded. **Unable to load the metadata for assembly 'LowLightGrab'.** This assembly is the UserControl I am using here. – Norick Jan 21 '15 at 08:46
  • also check your settings in devenv.exe.config. "". Might solve the loading problem in case of network issue. – Ebenezar John Paul Jan 21 '15 at 09:03
  • @Ebenezar I tried it allready without success. I also have to say that both projects (UserControl & WPF) are in the same folder **C:\temp\..**. Is it possible to put the UserControl project in the WPF-project in order that the metadata are found? – Norick Jan 21 '15 at 09:22
  • besides this error there is another one: **The type 'lowLightGrab:UserControl1' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built. c:\temp\WpfApplication1LL_Neu\WpfApplication1LL_Neu\MainWindow.xaml** – Norick Jan 21 '15 at 09:24
  • Only an incorrect path and missing dependencies for the referenced assemblies causes this error. I am sure you must have already checked these tons of times. please check the dlls path and association while being built. also try a clean build, it could give you a clue in case of any dlls washing away during the build. – Ebenezar John Paul Jan 21 '15 at 09:40
  • @Ebenezar I re-checked the path of the dll again but I could not find anything wrong. A clean-up and a re-build gives no warning and errors. What I also do not understand is why I can debugg the application although the desinger can not be loaded? And if I run the application the user-control is loaded. – Norick Jan 23 '15 at 12:49

1 Answers1

0

Once added as reference it will be copied to output folder.

For design time you have to add in your Window:

xmlns:VCECLB="clr-namespace:VCECLB;assembly=VCECLB"
profimedica
  • 2,716
  • 31
  • 41