c# - Setup environment using batch file for DotNet Framwork 4.0 Command line for easy way around -


i have .net framework 4.0 (and older versions)installed, want use command line compiler c#

csc.exe

now found across few forums using direct path can use compiler, using batch file 1 can that,

i need set environment variables link part of visual studio(if installed work) want use compiler framework(with command line) free. not want install visual studio, not want purchase license testing purpose.

my current csc file location path c:\windows\microsoft.net\framework\v4.0.30319

this path , compiler file works fine every time have write , times have seen error related library.

c:\windows\microsoft.net\framework\v4.0.30319\csc.exe sample.cs 

this avoid writing long path each time testing sample codes.

please provide best available option/alternate(if batch file available great). appreciated

edit 1: set path

paul's answer fine, , have used issue same library files not found.

if using batch file add start

set path=c:\windows\microsoft.net\framework\v4.0.30319\;%path%

this add .net framework start of path current run of batch file only.

now batch file can use

csc.exe sample.cs


Comments