Search code examples
c#c++wpfpinvokexbap

Deploying XBAP with win32 DLL


My XBAP application uses two win32 dlls and as usual many .Net dlls. Since we add .net references to the project itself, that is not a problem, as they all get deployed automatically when publishing the project; only that their names change from mydotnet.dll to mydotnet.dll.deploy.

But the problem is, the win32 dlls don't get deployed, neither their names change. And I understand the reason. It's because I call them using p/invoke techniques, and they're not added to the project. In fact, visual studio 2010 doesn't let me add them to the references. So I manually copied them to the publish-folder, and tried experimenting if that works. But it didn't work. The error the browser shows, is this:

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

at Player.PlayerProxy.Initialize()
atRunaware.WpfBrowserApp.Player.Page1.PlayFile(Object sender, RoutedEventArgs e)

Can anyone explain me what is going on? And any solution for that?


Previously I was trying to do what I want to do in Silverlight, but Austin suggested me to use XBAP to achieve the same thing. URL to the previous topic:

Handle to Silverlight UserControl


Solution

  • Can you try:

    1. Checking your project properties under the Publish > Application Files section and if your native dlls appear there, making sure they are set to include.

    2. Try including the dlls as content files in your project with copy to output directory set to Copy Always (I would think this may make them appear in the list of references mentioned in point 1, allowing you to set them to "Include").