How to Add DLL to Visual Studio? (Unconventional form)

Asked

Viewed 1,613 times

6

I’m trying to add a few DLL's to my project at Visual Studio (Unconventionally).

What I mean is, within my project, but outside References !

According to the image below:

inserir a descrição da imagem aqui

The reason you use Dlls this way is because Visual Studio doesn’t allow you to insert some DLLs in References.

I know there is this way to insert the Dlls, as shown in the image, however, I do not know how to do this type of import.

  • How to import Dlls this way?
  • 1

    Because it does not allow you to insert these dll’s?

  • The message that VS gives is this: could not be Added. Please make sure that the file is accessible, and that it is a Valid Assembly or COM Component. There are 8 Dlls, however, VS only allows to import 2. I would have to import according to the image(That way I know it’s right)

1 answer

3


From what I’ve seen, what you’re really trying to do is just include a file in your project.

  1. You should open the folder of your project, inside the same visual studio. Right-click on your project and then go to "Open Folder in file explorer": Abrir pasta do seu projeto

  2. Include your .dll or desired file inside the folder that opened.

  3. Go back to visual studio and click on the "Show all files" button inside the window Solution Explorer:

Botão show all files

  1. Note that your file will appear half deleted, right click on it and click on "Include in project option".

Botão Include in projeto

  1. All right, after that you .dll will already be within your project...

You can also configure it to be copied to the output of your project by clicking on it with the right button, and selected the option Properties. Inside the window File properties, configure the option Copy to output directory.

Configuração do arquivo

Just a tip, the visual studio 2019 already makes steps 3 and 4 automatically for you... I think only in older versions this is still necessary.

I hope I’ve helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.