How to Open Source Code in Visual Studio

Visual Studio is a software product for source code management. Open-source community projects like ReactJS and MeteorJS use the platform to manage their open source repositories. In this article, we can see how to open source code in Visual Studio.

Step by step guide on how to open source code in Visual Studio. Includes information about the option to create a “shared project” or a “solution”, how to access settings for the Git version control, and tips on best practices during development.

VSCodium

Code OSS screenshot

(Seth Kenlon, CC BY-SA 4.0)

The easiest alternative to VS Code is VS Code itself, built without Microsoft’s proprietary additions. The VSCodium project provides downloadable executables of Code – OSS, built from the VS Code codebase without Microsoft’s product.json changes. The VSCodium developers also go to great length to deactivate all hard-to-find telemetry options, delivering the cleanest build of VS Code’s source you can find without building it yourself.

VSCodium cautions that VS Code quietly includes some proprietary tools that cannot be shipped with an open source build. This includes a C# debugger and some gallery extensions. If you need them, there are documented workarounds for these issues, but if you rely on something very specific in VS Code, you should verify that it functions in VSCodium.

Open any code

You can open code into Visual Studio in the following ways:

  • On the Visual Studio menu bar, choose File > Open > Folder, and then browse to the code location.
  • On the context (right-click) menu of a folder containing code, choose the Open in Visual Studio command.
  • Choose the Open Folder link on the start window. ImportantNot all code can be opened by using the Open Folder link from the Visual Studio start window. For example, if your code file was saved as part of a solution—in other words, in an .sln file—you must use one of the other options listed here to open your code.
  • If you are a keyboard user, press Ctrl+Shift+Alt+O in Visual Studio.
  • Open code from a cloned GitHub repo.

To open code from a cloned GitHub repo

The following example shows how to clone a GitHub repo and then open its code in Visual Studio. To follow this procedure, you must have a GitHub account and Git for Windows installed on your system. See Signing up for a new GitHub account and Git for Windows for more information.

  1. Go to the repo you want to clone on GitHub.
  2. Choose the Clone or Download button and then choose the Copy to Clipboard button in the dropdown menu to copy the secure URL for the GitHub repo.GitHub clone button
  3. In Visual Studio, choose the Team Explorer tab to open Team Explorer. If you don’t see the tab, open it from View > Team Explorer.
  4. In Team Explorer, under the Local Git Repositories section, choose the Clone command and then paste the URL of the GitHub page into the text box.Clone the project
  5. Choose the Clone button to clone the project’s files to a local Git repository. Depending on the size of the repo, this process could take several minutes.
  6. After the repo has been cloned to your system, in Team Explorer, choose the Open command on the context (right-click) menu of the newly cloned repo.Cloned repo
  7. Choose the Show Folder View command to view the files in Solution Explorer.Show folder viewYou can now browse folders and files in the cloned repo, and view and search the code in the Visual Studio code editor, complete with syntax colorization and other features.

Atom

Atom screenshot

(Seth Kenlon, CC BY-SA 4.0)

Atom is an open source IDE-like text editor that Microsoft acquired when it purchased GitHub. Like VS Code, you can extend the Atom editor with plugins and customize it with themes and your unique combination of tools. It is also cross-platform and has built-in GitHub integration. In short, Atom is potentially whatever you need it to be, so long as the extensions you need already exist or you’re willing to write them.

Also like VS Code, Atom includes metrics tracking by default. This can be disabled, and unlike VS Code, there are no arbitrary restrictions on extensions, so you don’t have to change up your workflow in exchange for your privacy. Atom is certainly a useful tool for coders, but it’s also a pretty great editor for anyone who uses a computer. If you’re looking for a good general-purpose text editor, give Atom a try.

Brackets

Brackets screenshot

(Seth Kenlon, CC BY-SA 4.0)

Brackets is a text editor and IDE aimed at web developers. It has strong support for HTML, CSS, JavaScript, PHP, and even Python. However, like VS Code, it has a rich ecosystem of extensions, so you can expand it to serve as your workbench for whatever language you work in the most.

There are extensions to help parse languages, to run scripts, and even to compile and execute code. Brackets has a traditional interface anyone can understand, whether or not you’re familiar with an IDE or even a text editor beyond a simple notepad. If you spend a little time adding relevant extensions and getting to know them, you’ll find Brackets a useful and subtle editor that helps you, through autocompletion and linting, avoid silly mistakes in whatever you’re typing. And if you’re writing code, it’ll probably make your testing and debugging workflow faster.

Run and debug your code

You can debug your code in Visual Studio without a project or solution! To debug some languages, you may need to specify a valid startup file in the codebase, such as a script, executable, or project. The drop-down list box next to the Start button on the toolbar lists all of the startup items that Visual Studio detects, as well as items you specifically designate. Visual Studio runs this code first when you debug your code.

Configuring your code to run in Visual Studio differs depending on what kind of code it is, and what the build tools are.

Geany

Geany screenshot

(Seth Kenlon, CC BY-SA 4.0)

Geany is a powerful, stable, and lightweight editor with useful features to help you write good Bash, Python, Lua, XML, HTML, LaTeX, and more. There’s plenty of support for 50 different programming and scripting languages, markup languages, and miscellaneous filetypes (such as .diff and .po). At the very least, Geany almost certainly provides bracket matching and syntax highlighting—and it usually offers quite a lot more.

Geany is a modest little editor, but through plugins, you can add features such as a panel for a project view, filesystem tree, debugging, a terminal, and so on until it looks and acts like an IDE. Or, if you prefer, you can keep it simple and understated. If you can’t run VS Code on a computer due to limitations in CPU or RAM, Geany is the obvious alternative. It’s quick to launch, and its memory footprint is negligible. While Geany is a little heftier than running Vim in a terminal, it’s fast and snappy even on a Raspberry Pi.

Conclusion

Today, we are going to learn how to Open Source Code in Visual Studio. We will also see how to download code from GitHub.

0 Comments

No Comment.