.net C# "add reference"

Red Squirrel

No Lifer
May 24, 2003
71,312
14,084
126
www.anyf.ca
What does it mean when a tutorial says to "add a reference to MySql.Data" or other name? I can't seem to find info on it. I'm not using VC# I'm just using csc.exe, is it a parameter I have to pass?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
It is essentially the same thing as linking a library in a C++ app. You have to reference the assembly (.dll) that implements the namespace and types you're interested in. I don't know the command line compiler well, but in the IDE you do that by right clicking the "References" node under the project and clicking "Add". I'm sure it's just a simple list of switches and assembly names in the command line version.
 

Red Squirrel

No Lifer
May 24, 2003
71,312
14,084
126
www.anyf.ca
Thanks, I got it working. Had to do /reference:MySql.Data.dll and add using MySql.Data.MySqlClient to proper files.

I'm using csc.exe since it's way faster to double click a batch file to run a compile then to have a separate program open. I do everything in notepad++.
 
Oct 27, 2007
17,009
5
0
If you're programming C# in Notepad++ you're missing out on A LOT of what makes Microsoft's languages and framework really shine. I would strongly suggest using Visual Studio (Express Editions are free). Despite what some old timers will tell you, you're not cheating by using a fully-featured IDE. You're taking advantage of the thousands of hours of work already done by other developers.
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: RedSquirrel
Thanks, I got it working. Had to do /reference:MySql.Data.dll and add using MySql.Data.MySqlClient to proper files.

I'm using csc.exe since it's way faster to double click a batch file to run a compile then to have a separate program open. I do everything in notepad++.

:laugh: do yourself a favor and download VC# Express, you are only hindering yourself by not using it IMO.
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Originally posted by: GodlessAstronomer
If you're programming C# in Notepad++ you're missing out on A LOT of what makes Microsoft's languages and framework really shine. I would strongly suggest using Visual Studio (Express Editions are free). Despite what some old timers will tell you, you're not cheating by using a fully-featured IDE. You're taking advantage of the thousands of hours of work already done by other developers.

Thats cheating!! (No seriously, download VC# Express)
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
I think people should use the tools that work for them... but there is a reason why IDEs have taken over the software dev world. Of course, there are people who take a perverse sort of pleasure in using the hardest possible path, too ;)
 

Red Squirrel

No Lifer
May 24, 2003
71,312
14,084
126
www.anyf.ca
One of the main reasons I use notepad++ is because this program has multiple components and not all of them are C#, so rather then have a bunch of different programs open I have one, and it's all tabbed, nice search feature etc... It also loads in .5 secs for those times where I simply need to do a very quick fix.

I tried VS but I found it too cubbersome for simple tasks. For example, someone makes a bug report in the forum, I can just use launchy (nice little app btw, google it) the script in question loads up real quick in notepad++, I do the fix, save, recompile, test, deploy. Also only the core component needs to be compiled by C#, the rest is compiled with the program itself on load and creates a dll, then is loaded. So notepad++ does the trick for me.