
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 1.03 KB | hits: 10 | expires: Never
Embedding Third-Party .DLL's As Resources: (for example X360.dll)
1. Add a reference for X360.dll as you normally would.
2. Finish developing of your application.
3. Set the reference's value of "Copy to Local" to "False".
4. Go to the "Resources" page of "My Project" and select "Files", then "Add Existing File" and add X360.dll.
5. On the bottom right property box, set the name to X360.
6. Have your application's startup form load event look like this:
Private Sub MainFormLoad() Handles Me.Load
AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf AssemblyResolveFunction
End Sub
5. Make an AssemblyResolveFunction function similar to this:
Private Shared Function AssemblyResolveFunction(ByVal sender As Object, ByVal args As ResolveEventArgs) As Assembly
Dim AssemblyName As String() = args.Name.Split(",")
If AssemblyName(0) = "X360" Then
AssemblyName = Nothing
Return Assembly.Load(X360)
End If
End Function
6. Compile and Enjoy! :)