0

Similar question for c++ here

I've installed a package with nuget install and am using the csc.exe executable to compile c# files (and then execute via command line with $ ./test.exe) outside of a solution/asp.net project. My structure looks like this so far.

/lib
  test.cs
  test.exe
/packages
  /RazorMachine.2.6.1

Inside test.cs I need access to the RazorMachine class but am not sure how of the using syntax for accessing a local package? According to MSDN docs I can:

create an alias for a namespace or a type. This is called a using alias directive.

// need to reference directory structure?
using Project = PC.MyCompany.Project;
// definitely wrong
using RazorMachine = ./../packages/RazorMachine.2.6.1

I'm not sure what the correct terminology is to search for in the docs. I feel like I need some xml configuration to tell the program where to find the packages.

Community
  • 1
  • 1
Daniel Lizik
  • 3,058
  • 2
  • 20
  • 42
  • `csc.exe` isn't executing C# files. It's compiling them to an executable (exe) which you would then execute. – mason Aug 30 '16 at 19:44
  • yes i've got that down, not sure how to actually write the correct c# file though – Daniel Lizik Aug 30 '16 at 19:44
  • sprry my terminology wasn't correct, meant compile, not execute. – Daniel Lizik Aug 30 '16 at 19:45
  • Well you stated it wrong in your question, which is why I pointed it out. Anyways, you don't modify the C# file. You just need to tell the compiler where the assemblies are you're referencing. I suggest you look up the documentation for `csc.exe` and see how you reference libraries. There's an example of this referencing in [this question](http://stackoverflow.com/questions/10722832/csc-exe-reference-external-dll-file). – mason Aug 30 '16 at 19:46

0 Answers0