Void Star
Void Star

Reputation: 2521

A better approach to adding DLLs in VB.NET projects

I want to use a DLL written in C in a VB project such that the DLL will be copied to the output directory. I earlier asked this question here and got an excellent answer: VB.Net using C DLL All you have to do is go to the Project menu and "Add Existing Item". This works great if you copy any updates to your DLL into the project folder. Now I have a new project, and I put my C project folder inside the Visual Basic project folder in hopes that Visual Basic would fetch the DLL from that folder and copy it to the output directory. Oh no, they would never make it that easy. Adding an existing item copies that file to the project folder. So now it always fetches an old copy of the DLL unless I manually fix this, which I do not want to. How can I make Visual Basic honor my wishes?

Upvotes: 0

Views: 4642

Answers (1)

Jim O'Neil
Jim O'Neil

Reputation: 23764

When you do the "Add Existing Item..." the Add button has two options, one that will add a Link to an existing file and not copy to your project, but it will copy to the build output.

enter image description here

Upvotes: 5

Related Questions