Scott Hanselman

Visual Studio's most useful (and underused) tips

August 17, '16 Comments [104] Posted in VS2015
Sponsored By

There was a cool comment in my last blog post (one of many, as always, the comments > the content).

Btw, "until I realized that the Solution Explorer tree nodes are searchable." This one is a saver!

The commenter, Sam, noticed a throwaway bit in the middle of the post where I noted that the Solution Explorer was text-searchable. There's a lot of little tricks like this in Visual Studio that even the most seasoned developers sometimes miss. This phenomenon isn't limited to Visual Studio, of course. It's all software! Folks find non-obvious UX all the time in Windows, OSX, iPhone, everyday. If UX were easy then everything would be intuitive but it's not so it ain't. ;)

There's an old joke about Microsoft Office, which is known for having a zillion features.

"Most of the exciting new Office features you discover have always been in Office." - Me and Everyone Else

Here's some exceedingly useful stuff in Visual Studio (It's free to download and use, BTW) that folks often miss.

Search Solution Explorer with Ctrl+;

You can just click the text box above the Solution Explorer to search all the the nodes - visible or hidden. Or, press "Ctrl + ;"

Ctrl ; will filter the Solution Explorer

Even stuff that's DEEP in the beast. The resulting view is filtered and will remain that way until you clear the search.

Ctrl ; will filter the Solution Explorer and open subnodes

Quick Launch - Ctrl+Q

If there is one feature that no one uses and everyone should use, it's Quick Launch. Someone told me the internal telemetry numbers show that usage of Quick Launch in the single digits or lower.

Do you know that you (we) are constantly digging around in the menus for stuff? Most of you use the mouse and go Tools...Options...and stare.

Just press Ctrl+Q and type. Need to change the Font Size?

Find the Fonts Dialog quickly

Want to Compare Files? Did you know VS had that?

Compare Files

What about finding a NuGet package faster than using the NuGet Dialog?

image

Promise me you'll Ctrl+Q for a few days and see if you can make it a habit. You'll thank yourself.

Map Mode for the Scroll Bar

I love showing people features that totally surprise them. Like "I had NO IDEA that was there" type features. Try "map mode" in the Quick Launch and turn it on...then check out your scroll bar in a large file.

Map Mode for the Scroll Bar

Your scrollbar will turn into a thumbnail that you can hover over and use to navigate your file!

Map Mode turns your Scrollbar into a Scroll Thumbnail

Tab Management

Most folks manage their tabs like this.

  • Open Tab
  • Repeat
  • Declare Tab Bankruptcy
  • Close All Tabs
  • Goto 0

But you DO have both "pinned tabs" and "preview tabs" available.

Pin things you want to keep open

If you pin useful tabs, just like in your browser those tabs will stay to the left and stay open. You can not just "close all" and "close all but this" on a right click, but you can also "close all but pinned."

image

Additionally, you don't always have to double-click in the Solution Explorer to see what's in a file. That just creates a new tab that you're likely going to close anyway. Try just single clicking, or better yet, use your keyboard. You'll get a preview tab on the far right side. You'll never have more than one and preview tabs won't litter your tab list...unless you promote them.

Navigate To - Ctrl+, (Control+Comma)

Absolutely high on the list of useful things is Ctrl+, for NavigateTo. Why click around with your mouse to open a file or find a specific member or function? Press Ctrl+, and start typing. It searches files, members, type...everything. And you can navigate around with your keyboard before you hit enter.

There's basically no reason to poke around in the Solution Explorer if you already know the name of the item you want to see. Ctrl+, is very fast.

image

Move Lines with your keyboard

Yes I realize that Visual Studio isn't Emacs or VIM (unless you want it to be VsVim) but it does have a few tiny tricks that most VS users don't use.

You can move lines just by pressing Alt-up/down arrows. I've never seen anyone do this in the wild but me. You can also Shift-Select a bunch of lines and then Alt-Arrow them around as a group.

Move those lines with ALT-ARROW

You can also do Square Selection with Alt and Drag...and drag yourself a nice rectangle...then start typing to type on a dozen lines at once.

Perhaps you knew these, maybe you learned a few things. I think the larger point is to have the five to ten most useful features right there in your mind ready to go. These are mine. What are your tips?


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have been trying to take the pain out of multi-tenant deployments. Check out their 3.4 beta release.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Visual C++ for Linux and Raspberry Pi Development

April 6, '16 Comments [20] Posted in Open Source | VS2015
Sponsored By

It's bananas over at Microsoft. Last week they announced you can run Bash on Ubuntu on Windows 10, and now I'm seeing I missed an announcement of an extension to Visual Studio that enables Visual C++ for Linux Development.

With this extension you can author C++ code for Linux servers, desktops and devices. You can manage your connections to these machines from within VS. VS will automatically copy and remote build your sources and can launch your application with the debugger. Their project system supports targeting specific architectures, including ARM which means Raspberry Pi, folks.

ASIDE: I also noticed there's a C/C++ extension for Visual Studio Code also. I need to add that to my list of stuff to check out, it looks pretty compelling as well.

Once Visual C++ for Linux Development is installed, you go and File New Project like this. Cool to see Linux in that list along with a Raspberry Pi project.

File New | Linux App

You can pick x86, x64, and ARM, and you can see Remote GDB Debugger is an option.

Remote GDB Debugger

Here I'm running Ubuntu in a VM and connecting to it over SSH from Visual Studio. I needed to set up a few things first on the Ubuntu machine

sudo apt-get install openssh-server g++ gdb gdbserver

Once that was setup, connecting to the remote Linux machine was pretty straightforward as VS is using SSH.

Debugging C++ apps remotely talking to a Linux VM

Pretty cool.

NOTE: Today this cool extension has nothing to do with the Bash on Ubuntu on Windows announcement or that subsystem.  The obvious next question is "can I use this without a VM and talk to gdb on the local Linux subsystem?" From what I can tell, no, but I'm still trying to get SSH and GDB working locally. It's theoretically possible but I'm not sure if it's also insane. Both teams are talking, but again, this feature isn't related to the other.

This extension feels a little beta to me but it does a good job providing the framework for talking to Linux from VS. The team looks to be very serious and even has a cool demo where they code and debug a Linux desktop app.

If you're looking for a another full featured solution for Linux and Embedded Systems development with Visual Studio, be sure to download and check out VisualGDB, it's amazing.


Sponsor: Quality instrumentation is critical for modern applications. Seq helps .NET teams make sense of complex, asynchronous, and distributed apps on-premises or in the cloud. Learn more about structured logging and try Seq free for 30 days at https://getseq.net.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Docker for Windows Beta announced

March 26, '16 Comments [25] Posted in VS2015
Sponsored By

Docker Desktop AppI'm continuing to learn about Docker and how it works in a developer's workflow (and Devops, and Production, etc as you move downstream). This week Docker released a beta of their new Docker for Mac and Docker for Windows. They've included OS native apps that run in the background (the "tray") that make Docker easier to use and set up. Previously I needed to disable Hyper-V and use VirtualBox, but this new Docker app automates Hyper-V automatically which more easily fits into my workflow, especially if I'm using other Hyper-V features, like the free Visual Studio Android Emulator.

I signed up at http://beta.docker.com. Once installed, when you run the Docker app with Hyper-V enabled Docker automatically creates the Linux "mobylinux" VM you need in Hyper-V, sets it up and starts it up.

"Moby" the Docker VM running in Hyper-V

After Docker for Windows (Beta) is installed, you just run PowerShell or CMD and type "docker" and it's already set up with the right PATH and Environment Variables and just works. It gets setup on your local machine as http://docker but the networking goes through Hyper -V, as it should.

The best part is that Docker for Windows supports "volume mounting" which means the container can see your code on your local device (they have a "wormhole" between the container and the host) which means you can do a "edit and refresh" type scenarios for development. In fact, Docker Tools for Visual Studio uses this feature - there's more details on this "Edit and Refresh "support in Visual Studio here.

The Docker Tools for Visual Studio can be downloaded at http://aka.ms/dockertoolsforvs. It adds a lot of nice integration like this:

Docker in VS

This makes the combination of Docker for Windows + Docker Tools for Visual Studio pretty sweet. As far as the VS Tools for Docker go, support for Windows is coming soon, but for now, here's what Version 0.10 of these tools support with a Linux container:

  • Docker assets for Debug and Release configurations are added to the project
  • A PowerShell script added to the project to coordinate the build and compose of containers, enabling you to extend them while keeping the Visual Studio designer experiences
  • F5 in Debug config, launches the PowerShell script to build and run your docker-compose.debug.yml file, with Volume Mapping configured
  • F5 in Release config launches the PowerShell script to build and run your docker-compose.release.yml file, with an image you can verify and push to your docker registry for deployment to other environment

You can read more about how Docker on Windows works at Steve Lasker's Blog and also watch his video about Visual Studio's support for Docker in his video on Ch9 and again, sign up for Docker Beta at http://beta.docker.com.


Sponsor: Thanks to Seq for sponsoring the feed this week! Need to make sense of complex or distributed apps? Structured logging helps your team cut through that complexity and resolve issues faster. Learn more about structured logging with Serilog and Seq at https://getseq.net.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

ASP.NET 5 and .NET Core RC1 in context (Plus all the Connect 2015 News)

November 19, '15 Comments [32] Posted in ASP.NET | Open Source | VS2015
Sponsored By

Connect() 2015 - Scott Hanselman's KeynoteIt was a huge day in New York today as I got to join Scott Guthrie and the team at the Connect() 2015 event as they announced a bunch of stuff, including, but not limited to:

  • Visual Studio Code is now Open Source and a new Beta that supports extensions is out now!
  • ASP.NET 5 RC1 is out with .NET Core and has a Go Live License. This means you can go into production with ASP.NET 5 on Windows or Linux and Microsoft will support you.
  • You can get ASP.NET at, wait for it, http://get.asp.net. Yes. This lively URL is a mini-site that will look at your OS and show you Linux, Mac, or Windows (try visiting it on a mobile phone for fun, too) and tell you how to get ASP.NET.
    • If you insist, you can visit https://get.asp.net/OtherDownloads for a list of all the packages and combinations available. There is a .pkg for Mac and a .tar.gz and some instructions for Linux. In the future I hope/expect we'll have .NET in some popular OS package managers.
  • Node.js Tools 1.1 for Visual Studio was also released. A lot of folks don't realize how cool Node.js development is in Visual Studio. Node.js Tools for VS is free and open source AND works with the Visual Studio Community, which, ahem, is also free.

If you don't have Visual Studio, I'd recommend you grab Visual Studio Code which is a non-threatening size and runs on any OS, then if you're a command line person you can do this on Windows:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "&{iex ((new-object net.webclient).DownloadString('https://dist.asp.net/dnvm/dnvminstall.ps1'))}"

or this on Linux/Mac.

curl -sSL https://dist.asp.net/dnvm/dnvminstall.sh | sh && source ~/.dnx/dnvm/dnvm.sh

And yes, we have have formal ways to get this and you can again, always go to https://get.asp.net and check our SSL cert. ;)

Connect 2015 Keynotes and Videos

You can watch everyone's talks here and my specific keynote here. My talk was complex and varied but also very personal as we built all the demos around my diabetes and blood sugar system. I also used the Nightscout Open Source CGM Project and gave them a shoutout as well. I use Nightscout to remote my continuous glucose meter's data to the cloud. That glucose data collector runs in an Azure Web Job that I've blogged about before.

We had so much fun making our "parade" of cool cloud demos. I get tired of doing demos around product catalogs and such, so we build a connected Health Clinic. We pulled data in from thousands of (simulated) Microsoft Bands, as well as my actual physical Band 2 that I wear every day. We combined my heart rate data with my actual live and historical glucose data and ran it through Azure Machine Learning to create a "Hanselman Stress Index" to get a sense of how stress and my schedule affects my heart rate and blood glucose. You should really watch the video to get the full effect.

We'll do some cleanup of the slides and code and try to get it all on GitHub soon(ish) so please be patient with us.

image

I also want to point out the documentation for ASP.NET 5 RC1 over at http://docs.asp.net. This documentation is hosted and built at ReadTheDocs using Python and Sphinx and managed as source in GitHub using reStructuredText.

Contributing to the docs is a great way for YOU to get involved in Open Source, especially if you are a FirstTimer! Check out this great video on how to contribute to the ASP.NET documentation.  The community can contribute by:

The Mega List of Connect() 2015 Information

You want it all? OK, here you go, the list of everything announced at Connect() 2015:

What does it all mean?

It means that you can build basically whatever you want, however you want. You can use the editor you like, the OS you like, and the languages you like. VSCode on a Mac doing Node and deploying to Azure? Check. ASP.NET 5 with C# to Docker Containers in a bunch of VMs created in Azure and managed with Microsoft Operations Manager? Check. And on and on. Node.js on VS, C to Raspberry Pi's in C in VS, whatever you dig. It's a whole new world.


Sponsor: Big thanks to Octopus Deploy for sponsoring the feed this week! Check out their amazing product. I'm a fan.

Build servers are great at compiling code and running tests, but not so great at deployment. When you find yourself knee-deep in custom scripts trying to make your build server do something it wasn't meant to, give Octopus Deploy a try.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Visual Studio 2015 Released plus ASP.NET 5 Roadmap

July 21, '15 Comments [33] Posted in Open Source | VS2015
Sponsored By

Microsoft released Visual Studio 2015 today! You can watch the keynote video from today with me, Soma, Beth Massi, Amanda Silver, and Brian Harry here on Channel 9. All the supporting videos and Q&A are also up as individual videos if you'd like.

ASP.NET in 2015

NOTE: Because ASP.NET 5 will not only run on .NET Framework 4.6, which was released today, but also on the .NET Core Framework that will support Windows, Mac, and Linux, ASP.NET 5 isn't released today. The ASP.NET 5 roadmap is up on GitHub though. We'll have a Release Candidate that you can Go-Live with Microsoft support in November and it will 1.0 in the first quarter of 2016. Also, be sure to grab the free Visual Studio Code, no matter what platform you're on. http://code.visualstudio.com

That ASP.NET 5 developers should start exploring the framework now, and go live around the holidays on the operating system of your choice with ASP.NET 5 and the Core CLR. We'll keep doing the weekly ASP.NET Community Standup and updating you each week on our progress. Remember that the schedule is at http://www.asp.net/vnext and the documentation is growing at http://docs.asp.net.

ASP.NET 4.6

That said, ASP.NET 4.6 is live today and included in Visual Studio 2015 and VS has some great new features for Web Developers.

  • JSON is first class with a .json editor and JSON Schema validation within VS. There's also intellsense for bower.json, npm, and other JSON formats.
  • Even more HTML 5 support in the editor. Of note is intellisense for Angular, ARIA, and Bootstrap CSS classes. We're also watching Web Components and including support (as the world decides) for things like link rel="import."
    Angular
  • JavaScript support for Angular JS controllers, factories, animations, etc. Support for JSDoc and more.
  • Syntax Highlighting and intellisense for ReactJS! Support for Grunt and Gulp!
  • HTTP/2 Support in ASP.NET 4.6 with SSL enabled on Windows 10 and IIS Express.

There's lots of significant updates in 2015, but Roslyn is likely the most significant. Roslyn is the open source .NET Compiler Platform. It includes the new features Visual Basic and C# 6 and can be used in your ASP.NET Web Forms projects, pages, and MVC pages.

For example, with String interpolation, this link in Web Forms:

<a href="/Products/<%: model.Id %>/<%: model.Name %>">

looks like this with C# 6. See the string that starts with $""? It's got model's embedded within it. Common calls to String.Format get a LOT easier with this feature.

<a href="<%: $"/Products/{model.Id}/{model.Name}" %>">

Web Forms in ASP.NET 4.6 gets async model binding as well, which means less digging around in the Request object for stuff and you'll do it all asynchronously.

Visual Studio Community 2015 - It's Free!

If you're a student, open-source contributor or a small team, Visual Studio 2015 Community is free. You can use extensions and develop however you'd like. We've got not just Windows and Web Apps, but you can also use Xamarin or Cordova, and even use our Windows Phone and Android Emulators.

Learn about the Community, Professional, and Enterprise versions here and compare them in a feature matrix here.

I'm using Visual Studio 2015 to edit even .NET 2.0 apps so I'm not using older versions of VS, but if you like, it does live side-by-side. On one machine I have 2010, 2012, 2013, and 2015, even though it's not really needed.

The final versions of all of today’s releases are available now. 


Sponsor: Big thanks to Infragistics for sponsoring the feed this week. Responsive web design on any browser, any platform and any device with Infragistics jQuery/HTML5 Controls.  Get super-charged performance with the world’s fastest HTML5 Grid - Download for free now!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Page 1 of 3 in the VS2015 category Next Page

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.