[MUSIC].
>> Sayed Hashimi here,
and we're going to talk about how you can
improve your productivity as
a.NET Core developer and Visual Studio for Mac.
In this video, I'm going to show you a couple of
new features as well as
some features that have existed for a long time.
So please definitely do stay tuned.
All right, so first we're
going to start off with some new features
that we've added in Visual Studio for Mac 8.3.
Let's start with launch settings like JSON support.
This is a JSON file that you can have in your project and it
defines how your application will be
launched either for run or debug.
Typically, you'll set your ASP.NET
Core environment here either production,
or development, or any custom value that you might have.
You can also define any additional
environment variables that you'd like.
So here I've got devadmin@example.com for
the admin e-mail and then we've
also got the URLs that the application will be listening to.
You can edit it either directly in
the file or you can right-click the project and select
"Options," go down to "Run
configurations" and then I'm going to go into "Default" here.
It's going to make some changes here.
So I will change this from example.com to contoso.com.
We switch over to the ASP.NET Core tab and we'll modify
the URL so we'll change it from 5001 to 5011.
All right, now we can see that both of those changes have made
it into my launch settings at JSON file.
Let's take a look at what we get when we run this.
So I'll start without debugging here.
All right, we can see that the application is now up and
running and the index page just
displays the value for
those two environment variables
ASP.NET Core environment and Admin e-mail.
You can see that the new e-mail has come through here.
All right, let me switch back to
Visual Studio for Mac and then I will move on to
another topic or another feature that we've
recently added for 8.3.
So let me stop debugging here and you may have noticed
this while I was running through the previous demo.
So here we can see now we have
a browser select option here at the very top toolbar.
So you can pick whichever browser you'd
like to be launched for a particular project at that time.
Right now I've got it configured for Microsoft Edge,
but let's say maybe you had a report that
your website is not rendering correctly
using Safari and now you're working on that bug.
So you can just switch over to Safari and then say start without
debugging and then that should
launch Safari with your application inside of it.
All right, so now we can see that instead of launching
Edge as what it did before,
now it's launched Safari and we can party on
the application using Safari or any other browser that you'd like.
Let me go in and quit out of Safari here.
Another feature which has been added recently,
it was previous 8.3 I believe it was an 8.2.
We've simplified the ability to configure
multiple start-up projects and when you're developing
web projects it's very common that you
need to launch more than one web project.
Maybe you have an API project and a web front-end,
or maybe you have
two web projects that have some interaction together.
So yeah, let me show you how to launch more than one project.
You right-click on the "Solution"
you go into "Set start-up projects"
and this behind the scenes will create what we
call a run configuration in Visual Studio for Mac.
So go and select "Create run configurations" here.
At this point I can see all the runnable projects
that are in my solution.
So I'll check both of these web projects.
One thing that's important for
web projects if you want to launch more than one you need to
make sure that they're not trying to listen on the same URL.
So let me go here and my ENV var demo project is listening on
5011 and go to my other web
and just double-check that that's
on a different port before we get started.
All right, so this one's listening on 5002.
So we can see in the default toolbar here that
multiple projects has now been automatically selected.
We can go ahead and click the "Play" button to start debugging
this and both of those projects should be launched.
We can see one of the projects has launched in
Safari just because I just
configured it to launch in Safari and the
other one then launched in Microsoft Edge here.
So that's what we got going on. That's how you can set
more than one project to
start on run or debug in Visual Studio for Mac.
Let me go ahead and start debugging
here and also if you wanted to change the browser when you
have more than one project you can use this experience here so I
can switch back to Edge for
that browser and also to Edge for this browser.
All right, so that was setting multiple projects.
Another quick productivity tip that I have for you is
using the Navigate2 input field here.
We have a dedicated video for Navigate2,
but wanted to raise awareness for this feature here as well.
I can definitely save a lot of time.
The keyboard shortcut to get into Navigate2 is Command + dot.
So for example, let's say if I've just made some code changes.
Now, I'm ready to start debugging this.
So I can say I just did Command + dot and went into Navigate2.
I'll say I want to execute a command so I'll prefix it with C: and
then start and then I can
see debugging so I'll go ahead and select that.
All right, so now we can see both of
our projects have successfully
loaded in Microsoft Edge as we expected
and like I mentioned we do have a video
dedicated to Navigate2 so I'll definitely
link to that in the description below.
Now, let's move back to Visual Studio for Mac and
we'll go through a few other productivity ones here.
So the productivity, the one that I want to share with you
today is or at this point is to learn keyboard shortcuts.
So learning keyboard shortcuts is something that
can definitely speed up
your development process and there's definitely
a few keyboard shortcuts that you want to learn and know.
So I'll go ahead and share my favorites with you.
So let's start on the "Build" menu here.
So one is definitely build all so we can see that's Command B.
One that I just showed you previously was Command + dot
for Navigate2 that opens up a plethora of
options there and then start debugging is Command Enter.
Also I like to start without debugging
too because there's a lot of cases where
I just want to see my website or I
just want to exercise my console App.
So start without debugging is going to be a little bit
faster than start with debugging.
All right, let's take a look at some more here.
We've got the "Open Command," so that will open a new solution or
project and another big one is actually preferences here.
So I find myself going in and out of
preferences occasionally to kind of
change things or to discover additional features
which I may not be aware of.
So the shortcut for preferences is Command comma.
So let me go ahead and use that and now,
I'll show you how you can discover additional keyboard shortcuts.
So I showed you previously you can use
the menu system to actually learn about
commands and their keyboard shortcuts,
but some functionality isn't available on
menus or you may not see the keyboard shortcut.
So what we can do is I've gone into preferences and now
inside key findings you can search for any command that you want.
Let's say for example format.
So what's the keyboard shortcut for format document?
So here we can see it Control pipe.
Let's see, is there a keyboard shortcut for clean?
So yeah, it would be Shift Command + K for clean.
So this is a very handy way
for you to go through and actually learn
about commands and you can even set custom keyboard shortcuts.
For example, clean all doesn't have a key binding here.
So you can define a new key binding here
that you like and then you can go with that. All right.
Well, that's all the tips that I have for you now
with the exception of one additional tip.
Checkout aka.ms/VSMacDocs one word.
So that's where you can get all the docs for Visual Studio for Mac
and keep an eye out for new videos
in this video series. Thank you very much.
[MUSIC]