How to add reference to assembly in visual studio

2020-02-12 05:55发布

问题:

I am sorry. I am newbie in C#. I use Visual Studio Mac. I want to try to connect mysql database. I have added mysql package. When I run, I get error. The error is :

adding a reference to assembly ‘System.Data, Version-4.0.0.0, Culture=neutral, PublicKeyToken

回答1:

My solution in Visual Studio for Mac 7.3 Preview was to right click on the "Dependencies" node for the project and click "Edit References..."



回答2:

  1. In Solution Explorer, right click (two finger tap on mousepad for Mac) the 'Dependancies' folder under the Project (current project where you are seeing this error).

  2. Click 'Edit References'

  3. Select (list defaults to All available) Select (tick) the Project you need to reference that is holding 'System.Data'.

  4. Click OK.

This will create a link between these two projects and therefore a reference/dependency is created.



回答3:

The solution is :

  1. Double click folder 'References' in your project
  2. If you have error like me, you type 'System.Data' and click checkbox then click button


回答4:

In VS editor, right click on red-underlined error (two finger click on mouse-pad for Mac). The first option in context menu should be "Quick Fix >". From there you can select how you want to fix the reference, either add a using statement or fully qualify inline.