including linked DLL in installer packages - Visual Studio 2010
I've written a program that works perfectly well when installed on my development PC, but when I use the wizard in "Build-> Publish" and install the software on another computer it complains it can't find the DLL that I've linked to. The DLL comes from a programmable board that I'm linking to, so I don't have access to the source code, and I've included it in my project usin开发者_开发技巧g the following lines:
Declare Function InitMbee Lib "C:\Users\Martin & Celina\Desktop\VBmini\mb.dll" () As Boolean
Declare Function SetOutputs Lib "C:\Users\Martin & Celina\Desktop\VBmini\mb.dll" (ByVal outputs As Integer) As Boolean
However I've not included the DLL in any other way, so I'm wondering if I have to add it to a list of items that need to be included with the installer, or if I've declared it in such as way that it needs to be in the same place for all installations.
Any help would be greatly appreciated.
The IDE isn't smart enough to parse your source and see that you are pinvoking a DLL. In your regular project, Project + Add Existing Item and select that DLL. Select it in the Solution Explorer window. Properties window, set Build Action to "Content". That ensures that the IDE knows that it needs to be published as well.
Set Copy to Output Directory to "Copy if Newer". That ensures that the DLL ends up in the right place, the same folder as your EXE. Now go back to your Declare statements and delete the directory off the file name. That can't work, there won't be a Celina on the target machine.
精彩评论