I would like to compile a C# program from the command line in a Linux terminal. My csc.exe is added to my Path and works correctly. The directory layout is as follows:
| |-- Debug
| | |-- Newtonsoft.Json.dll
From the top directory, I use the following command to compile:
csc *.cs /r:./bin/Debug/Newtonsoft.Json.dll
--> error CS2001: Source file 'r:bin/Debug/Newtonsoft.Json.dll' could not be found
Is there a better way to do what I'm trying to do here, or will I just have to copy the .dll files I want into the same directory as
Program.cs, as is done in this question?
/reference argument is only used to indicate the name of the assembly.
To specify additional directories to search for assembly files use the
csc *.cs /r:Newtonsoft.Json.dll /lib:"./dir with spaces/need quotes", ./bin/Debug
Use /lib to specify the directory in which one or more of your assembly references is located. The /lib topic also discusses the directories in which the compiler searches for assemblies.