How to add external references in MonoDevelop?

2019-06-06 03:36发布

问题:

I've downloaded a charting library called NPlot and I have no idea how to add it as a reference in a GTK# application I'm currently making in MonoDevelop. There is no option in the Edit References window that you could add an external reference apart from the listed ones.

How do you add an external reference in MonoDevelop?

回答1:

Being fairly new to Ubuntu (consequently, to using apps), I found it quite challenging to grapple with the dilemma above. After hours of searching (almost half a day actually), I found the answer. I created this post for others who might be facing this problem too.

Before proceeding, make sure you have your dll file to add as a reference.

First, create a .pc file containing the following:

Name:  
Description:  
Version:  
Libs: -r:<where your dll is>

Example:

Name: NPlot
Description: Creates charts.
Version: 0.9.9.2
Libs: -r:/home/xxx/Downloads/NPlot/nplot-gtk-0.9.9.2/NPlot.dll

Hat tip to this site.

Remember where you've saved your .pc file. I've saved my file in /home/xxx/Documents. Next, copy the .pc file to /usr/lib/pkgconfig. I'm not sure with other Linux distros, but Ubuntu is preventing me to directly copy paste the file to the folder, so I have to use this command on the terminal:

sudo cp <source> <destination>

Example:

sudo cp /home/xxx/Documents/NPlot.pc /usr/lib/pkgconfig

It is now included in the Edit References window.

If the reference does not show, please refer to this question.



回答2:

  1. Unzip the NPlot zip file and extract the dll you need.
  2. In the Edit References dialog select the .Net Assembly tab.
  3. Click the Browse button and browse to the NPlot dll file and select Open.
  4. Click OK on the Edit References dialog.