Can You Use Visual Studio for Web Development?

Visual Studio has so many tools and technologies. But can these tools be used for web development?

Visual Studio is great for web development since it integrates numerous frontend and backend development technologies such as ASP.NET and Node.JS. Moreover, it has support for Python and comes with various extensions.

Read on to learn more about using Visual Studio for web development. This article will discuss everything you need to know to get started with the software.

Before we continue, please know that Visual Studio is not the same as Visual Studio Code. Visual Studio Code is my preferred code editor that I use daily. While on the other hand, Visual Studio is a lot more than a just code editor, it’s an IDE. At the bottom of the article, you can find a video that explains the difference between the two in more detail.

Backend Web Development Technologies in Visual Studio 

ASP.NET Core is the main technology for creating web applications in Visual Studio. It’s open-source and cross-platform, meaning you can host your application on various servers including IIS, Apache, and Docker. You can deploy your application to the cloud or a physical on-premise server.

It comes in two varieties: Razor Pages and MVC.  

ASP.NET Core Razor Pages is the newer architecture, which lets you combine C# logic with HTML and CSS in each page. This way, you can create dynamic pages that display different data to different users but have the same appearance. Razor Pages is an excellent solution for projects that mainly retrieve data from a source and display it to the user. It’s less complex and better organized than MVC because the entire code for a view is contained within one file. In fact, Microsoft recommends migrating to Razor Pages in these cases. 

ASP.NET Core MVC, is built on the traditional Model-View-Controller architecture. It’s more appropriate for large-scale applications with complicated business logic. The main advantage is that it separates data manipulation from how data is shown to the user. However, most novice programmers have a hard time understanding the concept of MVC, especially the controller part. 

If you’re just starting out, Razor Pages will be the better option. Watch these official tutorials by the renowned Scott Hanselman to hit the ground running: 

Other than ASP.NET Core, you can create web applications using Python’s Django framework. Visual Studio comes with project templates that help you get started quickly. If you’re a Mac user, you’re out of luck, unfortunately, because Python isn’t available in VS for Mac. 

Frontend Web Development Technologies in Visual Studio 

A website’s frontend is the content and appearance that users see and interact with. HTML, CSS, and Javascript are the foundation of a web application’s frontend, and Visual Studio comes with various tools to let you efficiently create validated HTML and style it with CSS. For example, its code-completion assistance, Intellisense, supports HTML, and tags are automatically closed once you write them. 

However, Visual Studio is much more versatile when it comes to frontend development. 

The Blazor framework lets you create interactive client-side applications with .NET. The primary advantage is that you can use C# instead of JavaScript. As a result, you can use .NET libraries in your frontend and won’t have to code the same logic twice—once in the backend and once in the front. This makes code maintenance much easier as you’ll need to change your code once. 

Visual Studio also integrates seamlessly with popular frameworks like Node.js and Angular and gives you various project templates to make your job easier. You can use these component-based frameworks to quickly create web applications and transfer data between the client and server. 

How To Use Visual Studio for Web Development

To use Visual Studio for web development, follow these steps:

  1. Install visual studio. You can find the link to download here, on Microsoft’s Visual Studio site.
  2. Select the appropriate development package. After running the installer, you’ll be prompted to choose a package. The right one to choose depends on what language or languages you’ll be using for development.
  3. Select your development settings. Once you download your package, you’ll see another dialog box prompting you to choose the right development settings.
  4. Personalize your workstation. You can change the color scheme, fonts, and overall layout of Visual Studio to meet your needs in the same window as your development settings, or you can adjust them later.
  5. Decide on an application idea. Choose an application that you want to build, and start working on it locally using Visual Studio to learn what it has and how you can use it.
  6. Create a new project. Once you have your environment set up and your idea ready to go, start your Visual Studio and select Create a New Project. This will redirect you to the project template screen, where you can choose your development technology and the purpose of your application. 
  7. Configure your project. You’ll be able to do this easily through guided, straightforward steps in a dialog box.
  8. Add new files. Create the necessary files for your project, organized in folders visible through the Solutions Explorer on the right hand side.
  9. Build your project. Compile your code by choosing Build Solution from the Build menu. The Output window will show the result. 
  10. Run your code. Once you’ve built your code, you can run it. Just choose Debug, then Start without Debugging. Alternatively, you can click the play button on the toolbar to load the project in debug mode. In either case, your IIS will start and your project will run in a new browser tab. 
  11. Install SSL certificate. If it’s your first time running the project, you’ll be prompted to get an SSL certificate, although you’re running the project on your local machine. It’s best to install the certificate so that you’ll be secure when you move your project to the remote server. Click Yes twice, and you’ll be done.

Visual Studio Features For Web Developers

Visual Studio is a feature-rich IDE that pulls the functionality of many programs into one place. It’s easy to configure and does a lot automatically, so you can use these tools without being an expert from the get-go.

 The features you get as a web developer in Visual Studio include the following:

  • An advanced code editor with Intellisense to efficiently write and manage code.
  • Support for HTML5, CSS3, LESS, SASS, and FontAwesome
  • Support for client-side frameworks including Angular, jQuery, Bootstrap, Django, Backbone.js, and Express. 
  • Version control, also known as source control, used to track the history of your code and save versions as you work so that you can revert to a previous stable version if an undiscovered bug finds its way to your production code.
  • Deployment software used to make applications public, like Web Deploy, InstallShield, and NuGet.
  • Software containers that allow you to deploy code to the cloud. 
  • Database connectivity for connecting to remote data sources.
  • A sharing environment that enables collaboration between developers.
  • Debugging tools to discover and address problems with your code.

Additionally, you can add more features by including extensions and plugins in your Visual Studio. Because many developers use the software globally, there are many options for add-ons and preset configurations. 

Visual Studio IDE used for web development
Visual Studio comes with plenty of nice features that otherwise need to be handled manually by installing different packages and tweaking different things. But in Visual Studio IDE things for the big part just work on their own, which can be a big time saver (for example, auto compiling from SCSS to CSS without using additional libraries and setting things up).

Is Visual Studio Worth the Price?

Visual Studio is available through tiered pricing starting at $45/month. While other IDEs are available at a lesser cost, Visual Studio has a uniquely large starting point for available features, so you might save money in the long run not having to purchase and install additional extensions.

Visual Studio also has a Community Edition, which is available free of charge. If you’re just starting out, it has all the features you need to become an experienced developer. There’s also a large community of support, so you’ll get farther using it than you would with a less well-known but cheaper alternative.

Visual Studio Extensions for Web Development

Besides its host of features, Visual Studio has an extensive ecosystem of extensions that expand its functionality. Here are a few good options for web developers: 

  • Image optimizer: Use lossy and lossless compression algorithms to reduce image sizes, including JPGs, PNGs, and even animated GIFs. 
  • Bundler & Minifier: Lets you combine multiple CSS and JS files to reduce server requests while also making the files smaller to save on transmission bandwidth. 
  • HTML Snippet Pack: A collection of premade HTML snippets to make your coding more productive. 
  • PHP Tools: Lets you create and debug PHP web applications using Visual Studio. 
  • Web Compiler: Lets you compile LESS, Sass, JSX, ES6 and CoffeeScript files. These are frameworks that add functionality to traditional CSS and Javascript languages and make them more efficient and easier to maintain. 
Video: Intro to Visual Studio in 5 minutes

Visual Studio Tips and Tricks

Visual Studio is a powerful tool. As you’re learning to use the software, consider these tips and tricks for using the different features.

Using the Debugger

To open the debugger in Visual Studio, hit F10. This will run your code and attach the debugger. Then you can execute your code line by line to see where the logic goes wrong. You can also press F5 to start the debugging program in debug mode, but the execution will stop as soon as your code throws an exception. This way, you can find the exact line of code that’s breaking your code and dig deeper to find the underlying issue. 

While walking through the debugging process, you’ll notice blue dots appearing in the margin. These indicate a switch of threads. 

Setting Up Shortcuts

To set up keyboard shortcuts in Visual Studio, open Options, then click Environment in the left-hand panel. From there, you can select Keyboard and then adjust your settings for each command. 

As an example, you might want to set up a keyboard shortcut for doing a git pull so that you can easily keep your code up to date.

Built-In Shortcuts

There are numerous shortcuts built into Visual Studio, including the following:

ShortcutAction
Ctrl + K then Ctrl + XInsert Snippet
Ctrl + K then Ctrl + SSurround with
Shift + Alt + WWrap with <div>
Ctrl + Shift + WView in Browser
Ctrl + F10Run to Cursor
Ctrl + K then Ctrl + FFormat Selection
Alt + EnterShow Action List
Ctrl + Shift + VPaste from Clipboard
Ctrl + Alt + EnterCode Reformat
Ctrl + SpaceCode Completion
Ctrl + Shift + F1Quick Documentation
Ctrl + /Line Comment
Ctrl + Shift + /Block Comment
Alt + F5Debug
Ctrl + Shift + Alt + RRun Config
Ctrl + Shift + F5Run Build

Formatting JSON

There are several ways to speed up the process of formatting JSON objects. For one, Visual Studio will insert quotation marks when you add a colon, making it easier to type JSON. For another, you can Paste JSON as classes by choosing the option under Edit > Paste Special. This allows you to copy from a .NET class into a C# or VB code file.

Using Tooltips

Visual Studio makes it easy to use the correct syntax. One way is by providing tooltips. Tooltips show up when you press the Control key or Ctrl + Shift + Space. When you press Control on its own, it will autocomplete the name of your function, and pressing Control with Shift and Space will show you what parameters your function needs.

Syntax Highlighting

Another way Visual Studio makes syntax easy is through color-coded syntax highlighting. When it recognizes certain keywords and formats, it will change the color of the text to illustrate to you how your code is going to run. You can use syntax highlighting to interpret whether there are problems in your code before running a build.

Using Tracepoints

Tracepoints are like breakpoints, but they print a message to the Output window instead of pausing the code. Tracepoints allow a program to run completely while still logging potential problems, and they are extremely useful during the debugging and development process. 

To create a tracepoint, open the Breakpoint Settings window and choose Tracepoint.

Using Preset Installation Configurations

When you’re configuring Visual Studio at your initial install, you can either choose each setting that you want to apply or import an entire set of configurations. You can also export a configuration if you want to share your setup. This makes it easy to share workspaces between members of a web development team.

Fuzzy Search

Visual Studio offers a fuzzy search feature in its search bar so that you can search for the approximate thing that you’re looking for instead of needing to match the text exactly. You can bring up this search bar by using the shortcut Ctrl + Q or by clicking on the search bar in the top menu of Visual Studio.

Live Share

A great Visual Studio feature for teams is the Live Share option. This allows you to share and debug your code with other developers in real-time, provided that they are also using Visual Studio. To do this, just click Live Share in the top right corner. Depending on what you need, you can either make the sharing read-only or allow the viewer to make changes.

Within the live sharing option, you have the choice to share voice. This allows you to talk through projects while you’re sharing code with teammates.

IntelliCode

IntelliCode is an AI-based developer assistant that offers auto-completion based on what you’re most likely to use, rather than offering suggestions in alphabetical order. IntelliCode gets smarter the more you use it, so you’ll be able to influence the accuracy of your suggested auto completes the more you work.

Video: Best Visual Studio Extensions for Software Developers in 2021

Alternatives to Visual Studio for Web Development

Visual Studio is just one integrated development environment (IDE). There are, in reality, quite a few IDEs out there that you can use for web development, each with its benefits and drawbacks. 

Xcode

Xcode is an alternative IDE made for use with the programming language Swift. It has live rendering within the Interface Builder, instantly applying code changes that you make within the design canvas. You can use it for web or application development, including development with Java and C/C++.

Xcode can be intimidating to new developers, partly due to the sheer size of the application. It takes up about 12 gigs of space, then takes a long time to install updates. To make Xcode run faster, you need to minimize the number of open tabs in your program and add more memory to your machine.

Some compare Xcode to Android Studio, but Xcode has better memory management between the two when looking at code loading, building, and handling multiple projects. Xcode is also great for not just Android but also iOS development.

Eclipse

Eclipse is ideal for a Linux environment, like when using C. You can also use it to code in Java and numerous other languages. Some say that Eclipse is the best code editor you can use when coding with Java.

Eclipse offers user-friendly source code reformatting options, but it also uses a lot of memory and can slow down a computer while it’s running. Eclipse is also not an ideal IDE if you want to code in Python or Node.js. 

Eclipse is highly customizable, both through built-in application features and project plugins. It’s also fast, low-cost, and easy to integrate with remote repositories on Github.

NetBeans

NetBeans is a free, open-source IDE with a large global community of developers and users. It’s easy to set up and works well with Java, PHP, C/C++, and more. It makes it easy to develop web, desktop, and mobile applications in one place. 

NetBeans offers customizable syntax highlighting for numerous languages but doesn’t offer a lot of other built-in tips. It also doesn’t have as big of an online community of users to go to with problems. Still, there are a decent number of available plugins for NetBeans, considering the size of the community.

Android Studio

Android Studio is another reasonable IDE, one that’s made specifically for Android application development. It’s based on IntelliJ IDEA and offers both mobile development and application development platforms. 

Android Studio comes with numerous built-in tools and plugins, including auto-completion and inspection features. It also has a tool for running Linux commands and a profiler for measuring application performance.

Some say that Android Studio runs more slowly than other IDEs because of its Android emulator. It’s difficult to multitask in Android Studio without slowing down the machine, as each project takes so much memory.

OutSystems

OutSystems is a full-stack application development IDE made for developers working on different applications, from consumer apps to business systems. OutSystems can be quite pricey at the enterprise level, but it is free to use for personal purposes.

It offers everything you need to manage, build, and deploy your web and mobile applications, and it runs more quickly than most IDEs. It offers a continuous deployment system to make your life easier, and it has a great built-in development operations platform.

That said, it can be difficult to transfer data between environments in OutSystems, and you’ll likely need the Data Migration Manager plugin. 

Advantages of Using an IDE for Web Development

Using an IDE allows a developer to start making new applications quickly because you don’t have to manually configure and integrate all necessary utilities. They’re built into the application so that you can learn how to use numerous tools all in one place at one time. 

IDEs save time for developers and make it easier to bring new team members into a project. They don’t have to work as hard to get integrated into the team’s workflow when every tool is already built into the environment they’re using.

Because IDEs parse code as you’re writing it, you can easily and quickly find bugs in your programs when using one.

Other text editors may offer the same syntax highlighting or autocomplete options as Visual Studio, but few offer the same level of environment and workflow customization.

Differences Between IDEs

IDEs vary in several ways. Some support different languages than others or are at least a better match for some languages than others. The same can be said for operating system compatibility, although some IDEs may be more strict in which operating systems they support.

Some IDEs offer more automation features, including but not limited to continuous integration and deployment tools. 

IDEs also vary in terms of their memory footprint, so you should keep that in mind if you want to run more than one memory-intensive application simultaneously. Know what your computer can handle before you get started, and you’ll set yourself up for success.

Finally, there are differences in the number of extensions and plugins available for different IDEs. Generally, the more popular an IDE is, the more people will have developed plugins and extensions.

Video: Visual Studio vs Visual Studio Code which one to choose

Conclusion

You can use Visual Studio for web development because it includes a code editor, a debugger, and build automation for your local device. These tools are all that you need to get started on a project. Other IDEs that can work in addition to Visual Studio include Xcode, Eclipse, and NetBeans.