Doing .NET development does not necessarily assume using the holy Visual Studio IDE. Every now and then, you need to code some simple piece of software that does not require a factory (read: Visual Studio).
Personally, I like to use Vim within Windows PowerShell to create/edit C# files rapidly, that also means that I need to compile and build my C# files within the command line. Having Visual C# installed on your PC, does not mean that the C# compiler is ready to be used outside of Visual Studio (within the command line for example). You have to manually add the path to the C# compiler (csc.exe) to your system or user environmental variables. Just follow along:
1- On Windows 7, click on the Start menu launcher, right-click on Computer, click on Properties. At the left of the window that appears, click on Advanced system settings.
2- At the bottom of the System Properties dialog, click on Environment Variables.
3- In the Environment Variables dialog box, click on the New button that appears in the User variables panel.
4- In the New User Variable dialog box, type CSharp (or what ever feels right to you) in the Variable name field, then type the path to the C# compiler (csc.exe) in the Variable value field. The path to csc.exe is: C:\WINDOWS\Microsoft.NET\Framework\v4.0\ (or C:\WINDOWS\Microsoft.NET\Framework64\v4.0\ for 64-bit systems). In this case '4.0' is the version of the .NET framework I'm currently using.
That's it. You can now launch a Command Prompt and verify that the C# compiler is ready to be used by typing: csc or csc.exe. If a message like the following (depending on your version of the .NET framework) is displayed:
Microsoft (R) Visual C# Compiler version 4.0.30319.17929
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.
then you've successfully configured your C# compiler.
Hope this helps. Happy coding ;-)
Personally, I like to use Vim within Windows PowerShell to create/edit C# files rapidly, that also means that I need to compile and build my C# files within the command line. Having Visual C# installed on your PC, does not mean that the C# compiler is ready to be used outside of Visual Studio (within the command line for example). You have to manually add the path to the C# compiler (csc.exe) to your system or user environmental variables. Just follow along:
1- On Windows 7, click on the Start menu launcher, right-click on Computer, click on Properties. At the left of the window that appears, click on Advanced system settings.
2- At the bottom of the System Properties dialog, click on Environment Variables.
3- In the Environment Variables dialog box, click on the New button that appears in the User variables panel.
4- In the New User Variable dialog box, type CSharp (or what ever feels right to you) in the Variable name field, then type the path to the C# compiler (csc.exe) in the Variable value field. The path to csc.exe is: C:\WINDOWS\Microsoft.NET\Framework\v4.0\ (or C:\WINDOWS\Microsoft.NET\Framework64\v4.0\ for 64-bit systems). In this case '4.0' is the version of the .NET framework I'm currently using.
That's it. You can now launch a Command Prompt and verify that the C# compiler is ready to be used by typing: csc or csc.exe. If a message like the following (depending on your version of the .NET framework) is displayed:
Microsoft (R) Visual C# Compiler version 4.0.30319.17929
for Microsoft (R) .NET Framework 4.5
Copyright (C) Microsoft Corporation. All rights reserved.
then you've successfully configured your C# compiler.
Hope this helps. Happy coding ;-)
Comments
Post a Comment