Home > Mobile >  How to open Visual Studio's C# program Folder by CMD Command
How to open Visual Studio's C# program Folder by CMD Command

Time:01-30

Like Html, CSS,JAvaScript or React folder can be open on Visual Studio Code by run command ( code . ).Similarly how can we open our C# program folder in visual studio by cmd command

I'll trying by code . but can't be open Visual studio.

CodePudding user response:

You could use the Windows start command:

start MySolution.sln

This will open the program registered for *.sln files which normally is Visual Studio.

CodePudding user response:

Step 1: Go to Control Panel -> System and Security -> System. Under Advanced System Setting option click on Environment Variables as shown below:

enter image description here

enter image description here

Step 2: Now, we have to alter the “Path” variable under System variables so that it also contains the path to the .NET Framework environment. Select the “Path” variable and click on the Edit button as shown below:

enter image description here

Step 3: We will see a list of different paths, click on the New button and then add the path where .NET Framework is installed.( If not installed, you need to install it yourself)

enter image description here

Step 4: Click on OK, Save the settings and it is done !! Now to check whether the environment setup is done correctly, open command prompt and type csc.

enter image description here

Step 5: Open the text editor like Notepad or Notepad , and write the code that you want to execute. Now save the file with .cs extension.

enter image description here

Step 6: Compile your C# source code with the use of command:

csc File_name.cs

If your program has no error then it will create a filename.exe file in the same directory where you have saved your program. Suppose you saved the above program as Hello.cs. So you will write csc Hello.cs on cmd. This will create a Hello.exe file.

enter image description here

Step 7: Now there are two ways to execute the Hello.exe. First, you have to simply type the filename i.e Hello on the cmd and it will give the output. Second, you can go to the directory where you saved your program and there you find filename.exe. You have to simply double-click that file and it will give the output.

Using Command:

enter image description here

Using .exe file:

enter image description here

  • Related