简体   繁体   中英

Running C# sample code in command line

Newb question here: I'm trying to run this sample c# code from https://developer.leapmotion.com/documentation/Languages/CSharpandUnity/Guides/Sample_CSharp_Tutorial.html for the Leap Motion.

Running the sample

To run the sample application:

Compile the sample application: On Windows, make sure that Sample.cs and either LeapCSharp.NET3.5.dll or LeapCSharp.NET4.0.dll are in the current directory. Run the following command in a command-line prompt (using the proper library reference for the .NET framework you are using): csc /reference:LeapCSharp.NET4.0.dll /platform:x86 /target:exe Sample.cs Note: use the csc compiler from the appropriate version of the .NET framework.

How do I figure out what .NET framework I have?

How do I make sure that Sample.cs and either LeapCSharp.NET3.5.dll or LeapCSharp.NET4.0.dll are in the current directory? This simply mean to put this folders in my CD right? Then execute:

csc /reference:LeapCSharp.NET4.0.dll /platform:x86 /target:exe
Sample.cs

Can someone translate what each segment in that line actually means?

From the command line, type dir to see what's in your current directiory. If sample.cs and the appropriate .DLL are there, you should be set to go.

To see what version of .NET you have, you can just type clrver in the Visual Studio Command Prompt. Just FYI, if you see version 2.0, that'll actually be 3.5 in this case (.NET 3.5 actually compiles on the 2.0 compiler, while 4.0 is an entirely different thing ).

And a breakdown of the command:

csc         // C Sharp Compiler
/reference  // Reference a DLL not in the GAC
/platform   // Compile for 32bit or 64bit?
/target     // Producing a DLL or EXE?
Sample.cs   // File to actually compile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM