Skip to main content

Posts tagged with 'visual studio'

David Neal is writing cross-platform desktop apps with Electron!

Show notes:

David Neal is on Twitter

Want to be on the next episode? You can! All you need is the willingness to talk about something technical.

Theme music is "Crosscutting Concerns" by The Dirty Truckers, check out their music on Amazon or iTunes.

In my view, Visual Studio Code doesn't share much with the standard Visual Studio software, except for the name.

This isn't a bad thing, per se. But don't expect all the features you're used to in Visual Studio.

Getting started is super easy. Open up a command lind, and type:

choco install visualstudiocode

Then navigate to some source code folder (still in command line) and type:

code .

(You may have to restart your command line environment, since chocolatey updates the path environment variable)

I used this on a PHP project. When I opened a php file, Visual Studio Code recognized it a such, and complained that it couldn't find the php executable.

If you are also using PHP, you'll need to go to File->Preferences->Workspace Settings. This will open up a JSON file that you can make changes to. It will probably be just an empty JSON object to start with.

You then have two options:

  1. Add "php.validate.enable": false
  2. Add "php.validate.executablePath": "path\to\php.exe"

I opted for #1, since I was just doing some quick hacking on a really simple PHP project.

Easy, peasy. Visual Studio Code doesn't take up much hard drive space; it's quick to install and use. So give it a try today.

One of my favorite VS extensions is SmartPaster. Often when I'm pasting something into Visual Studio, I'm pasting it into C# source code. It could be a long directory name, a JSON string, or some sort of template that's going into a StringBuilder. Doing this with plain copy/paste can be tedious because you need to escape certain characters, and often times VS or ReSharper can be uncooperative.

Instead, just install SmartPaster. You'll get a new right-click menu option: "Paste As", which lets you paste text as a literal string, a comment, or as a StringBuilder.

Screenshot of SmartPaster in Visual Studio

Here's an example of Paste As -> StringBuilder. Notice that it even does the string escaping for you (see the double quotes around "Paste As").

It's not useful every day, but it's a huge time saver when it is.

I've been working a little bit here and there on a mobile app. One thing this app does a lot is use a RESTful API over HTTP, where the results are JSON.

I'm using RestSharp to handle these requests, and RestSharp can automatically serialize Json results into C# object(s), assuming I have C# objects that match.

Well, some of these JSON results can be a little complex. Not terribly complex, mind you, but enough to where it's annoying to create the classes myself. But I thought to myself, maybe there's a tool out there that already does this for me. I googled around and found json2csharp, which is a handy web app that does exactly that.

Well, thanks to Rob Gibbens, I now know that this feature is actually built-in to Visual Studio 2013, and available for 2012 as part of "ASP.NET and Web Tools".

Paste JSON As Classes in Visual Studio

You can see that there are some differences, but these tools get you most of the way there!

Matthew D. Groves

About the Author

Matthew D. Groves lives in Central Ohio. He works remotely, loves to code, and is a Microsoft MVP.

Latest Comments

Twitter