PDA

View Full Version : Navigating to CSC.exe


squeaktoy2000
05-09-2002, 01:58 AM
Ugh! I'm so embarassed to ask this question, because it should be pretty easy to solve. I just installed the 131 Meg .Net SDK and I'm trying to compile my first .CS file into an .EXE. I can't seem to navigate (via cd or chdir in the command window) to CSC.EXE in order to do this.<BR><BR>How can I cd to Microsoft.NET directory?<BR><BR>-or-<BR><BR>How can I make the compiling programs (for C#, VB.NET, etc.) available from all directories under the command window?<BR><BR>Signed, <BR>Dumb about DOS.<BR>

shedao
05-09-2002, 09:59 AM
The .net framework install should have placed the path to the csc.exe into the system environment PATH variable. In other words you should be able to type "csc" from any directory and invoke the c# compiler.

shedao
05-09-2002, 10:01 AM
The path to the csc.exe is usually:<BR><BR><WINNT>Microsoft.NETFrameworkv1.0.3705csc.exe<BR><BR><BR>Where WINNT is your windows NT directory (IE: C:WINNT)

squeaktoy2000
05-09-2002, 01:26 PM
True, it should... have done that but it didn't for some odd reason. Anyway, I have Win XP Pro... so the directory you suggested isn't correct. That's no biggie, it was easy to find.<BR><BR>The only thing is... I'm sort of hoping to open command.exe, then navigate to csc.exe from there. That way, I could do a /? parameter and see all the instructions. Certainly, it would be helpful for a C# newbie like myself. Anyway, my DOS is extremely rusty. How can I add CSC to the system environment PATH variable? Also, when I try to navigate down from the trunk (c:) to the branch (c:windowsMicrosoft.NetFrameworkv1.0.3705csc.exe) I can get as far as c:windows but afterwards I get back "invalid directory" while trying to use the dos commands CD or CHDIR. <BR><BR>Any ideas on either. Sorry to post a stupid DOS question in here, but I suppose for ultra-newbies, it may be helpful.<BR>

squeaktoy2000
05-09-2002, 02:20 PM
OK, so here was MY particular solution:<BR>I looked up the list of C# compiler switches at: http://www.dotnet101.com/articles/art034_CompOptions.asp#@<BR>I made a simple *.RSP file which gives directions to the compiler. This method is much easier than typing out tons of stuff in a DOS command line.<BR><BR>From the C:> prompt in command.exe, I typed this (train wreck) set of commands: <BR>c:windowsMicrosoft.NetFrameworkv1.0.3705csc @c:DataDevelopmentProjectsC#helloworld.rsp<BR><BR>Inside my helloworld.rsp I had:<BR>/target:exe /out:C:DataDevelopmentProjectsC#HelloWorld.exe C:DataDevelopmentProjectsC#HelloWorld.cs<BR><BR>And Voila! Easy as doing your taxes in Swahili!<BR><BR>Anyway, the moral of the story is that it was never necessary for me to use DOS to navigate all the way down the directory tree to the specific folder containing CSC.EXE. I just typed in the whole path from the C:> and everything flowed from there. <BR><BR>Man is my DOS ever rusty....