.NET Core vs .NET Framework - What's the difference?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
dotnet Cora's been out for a couple of years now and a lot of misconceptions around it in this video we're gonna look at what dotnet core is who should be using it and what the benefits are I want to create this video beyond my normal Monday and Thursday videos just to introduce you to this topic since we going deeper in a dotnet core in the near future now if you haven't seen my other content my name is Tim quarry and it's my goal to make learning c-sharp easier that's why I create this content if you look in the description you'll see a link to a mailing list sign up to get exclusive discounts giveaways and more ok so what is dotnet core well let's create an NBC website both in the dotnet framework and net core to help serve as a frame for our discussion between the two so here I have Visual Studio 2019 open I've been using 2018 for a little while and actually as a video coming out very shortly they'll introduce you to 2018 and more of what doesn't how it works but in this video we're just gonna create a real quick web application in first the dotnet framework and then the dotnet core so we're going to look for asp.net and now it's saying we want a core application that's not right let's go back and look there we go ASP net web application dotnet framework so the first one by default which is a good thing in my mind the first one I default is asp.net core web application but there's also asp.net web application net framework rest like this one to get started so we have that dotnet framework to remind ourselves of what an MVC application looks like so call this the full framework MVC and we'll put this in my demo app location and we'll call this the framework versus core yeah okay and we're gonna use dotnet framework let's use the latest for 72 the least when I had on my machine for 72 and hit create and recreate an MVC application we will let's let's include no authentication where he is MVC not web forms or API no docker support and no unit tests it create and once that's done we'll come back and do this again for another project and create a dotnet core project so we can kind of see them side by side okay so there's the MVC application I'll minimize that for now right click on my solution and say add new project and this time I select the asp.net core web application I hit next I want to call this the core MVC where I select the web application Model View controller always known as MVC now notice over here on the right it says it's configured for HTTP I'm gonna uncheck the docker support we don't need that but it's there we won't do authentication you're using dotnet core 2.2 I could get a three but three is still not in release mode yet and I'd rather stick with 2.2 for now so MVC 2.2 HTTP configure by default let's hit run this and see we get okay so this starting page looks very similar to the other one and right now it's restoring so it's already created but it's still restoring the the packages so it's going to do that in the background for us which is nice so let's expand these two and look and see what the differences are so first of all in the full framework we have references and their references we have a lot of these references now in the MVC we have dependencies instead and inside dependencies one of them is nougat there's a couple of nougat dependencies that we have our SDK and that's which version of the.net core comes with this application then we have analyzers there's a lot less dependencies or at least a lot less that are visible but then of course you expand out dotnet core and there's quite a few inside there and these have their own dependencies so yeah there's a lot of dependencies still but the way you see it seems a little bit easier to to read through it understand so we can see that we call it references down here but it's really just a penance ease up here it I think the better word to call it dependencies because our MVC application is dependent on the things inside of the dependencies folder whereas our full framework application is dependent on all these references so it's it's a saying a similar concept I think a better name and it's better grouping as well okay if we come down to in our core we have W W root we don't have a an analog to that down here in the full framework this www root is where we store our static files things like our CSS or JavaScript even static HTML pages can go in here we don't have that type of thing in our MVC application so for example this the icon for our website lives inside WWE root but down here in MVC it lives right in the the main folder it's a little difference a little bit more separation better understanding of what goes where next we have the three folders for controllers models and views which we have controllers models and views as well but then have some interspersed things as well for example app data app start content fonts scripts and of course the the favicon so that's where again it's a little cleaner up here we can put those things like fonts they would go in the www root folder because there's static files so it kind of cleans it up in it brings it down to it's a little more understandable what's going on with MVC you got three folders controllers models and views it makes a little more sense I think so so far it's just been cosmetic changes we renamed dependencies we've moved things around a little bit hidden things under the www route but we're going to get into some more concrete details here in a minute for example we have app settings JSON this is where we store all of our configurations for example if we have a connection to a database without going here possibly but and this is where asp.net and dotnet core in general Todd takes it to the next level compared to the full framework this is just one type of configuration option for net core in fact it's not the configuration option they would recommend for things like connection strings everyone's concern about connection strings for good reason they gave away the security or database now for a web application not a huge deal because you control the web server but still something can consider it off well with core applications there's a stack of different options for example as your key vault which is an azure it's very very cheap and it stores securely encrypted your most sensitive information and that can plug in just like it was here in your app settings JSON in fact it will look in multiple locations and based upon your priority it will select the highest priority one that finds so you can have your app settings dot JSON for your local development but then have your as your key vault override that automatically in production even in dev or staging so really a next level also this is JSON very easy to write very easy to configure and very easy to read when it comes to pulling information into your c-sharp application the analog to this is the web.config much more stuff here and it's XML hard or right too hard to read harder to create systems to actually work the way you expect them to so definitely an upgrade there also web config doesn't have great ways of overriding it it does have some ways there's config transforms and things like that you can do but it pretty much is saying if you're looking for the web config I'm always going to live config I'm not gonna go to a sure when I've got the web config so that's kind of a downside of dotnet framework okay so now let's actually look at what the code behinds for these controllers look like the controllers kind of run an MVC application here is our full framework controller it looks pretty standard now of course is pretty much empty as well let's go to our home controller in dotnet core it also looks pretty standard in fact the differences are really minor we still have returned via we still name things and then create the views to match that name so privacy I knew I was here because we have a privacy method so it's pretty much the same thing as our full framework about therefore I can find about down here in views home about okay so the controllers look almost the same the code is fairly similar let's look at the views so look at that privacy view can you tell that's net core not dotnet framework not really it's pretty close to the same thing as what you'll find in dotnet framework so there's not a lot changed as far as you can jump right in a dotnet core and most of stuff is just gonna work the same way that's a really big deal now let's look at the layout page this is the layout page for dotnet core and we'll close the other ones for a minute and let's go look at the layout page for the full framework now there are some differences here for example we have this at Styles dot render and then the path to our CSS here this is how we're pulling in our CSS from Twitter bootstrap well that's just a link with a relative path but notice it's wrapped in include development so saying this environment is for development whereas for this environment which excludes and development we've got a different link for the same thing but it goes to the CDN the content delivery network so in dotnet core we have the ability to say well if you're in dev do this but if you're in production do something a little bit different the benefit here is in production we're going to look at a content delivery network which speeds up our clients downloading of the CSFB that's more easily cached however if you're a developer working offline or if you're a plane or whatever you might not want to go on to the CDN all the time to get your CSS it's just faster in general to have it local so you can use a local version that you've downloaded but you use the CDN version for production no other changes necessary no toggling back and forth or remembering to make that switch it's done for you plus you have a fallback so that the customer can fall back to the version that you normally use in development just in case for whatever reason CloudFlare goes down so cool stuff like that some definite upgrades to how we talk to controllers so for example this link says in the home controller call the index action it's a little different here we have HTML action link home index home it's a little more ugly this looks a lot more like just straight HTML which is pretty close to what it is so a lot of stuff in here these are called tag helpers so ASP - is a tag helper and there's lots of them but you have their context aware so it's Hank helper for a list item it's not the same list of tag helpers as the list in a anchor tag so definite upgrades here as well so overall we've seen that dotnet core just kind of takes it to the next level there's little tweaks here and there and there's bigger tweaks as well that just make it better make it easier and so that's one of the big things about dotnet core that people often overlook it's not just that has cross-platform and that is a big deal dotnet core will run on Windows Mac or Linux that means that all the very very cheap Linux servers out there they can run dotnet core that's a big deal but that's not the only deal about dotnet core and that's the message that's kind of gotten lost sometimes one of the other big deals about dotnet core is it's a general overall upgrade to how we work with a language it's easier it's more I must say more thought-out that's not really the right word because the dotnet framework was definitely thought out it's just that they took all the things they learned from a dotnet framework and said what bugs us what do we wish we could change we can't now he's got a bunch of legacy stuff and so they took those lessons learned and improved for dotnet core dotnet core throws away a lot of legacy stuff the dotnet framework has and has dependencies on and it starts over and so because that it's much much faster as well so you got a language that's faster you've got a language that's easier as a developer to work with you've got a language that is based upon the shoulders of giants and doesn't have all the legacy that the giants do that that first creative stuff so faster easier better that's what dotnet core is so as you've seen here it's not scary to move over the code looks very very similar it's easier and how we do the work it's more thought through and understandable when it comes to where's my stuff and generally it's just a lower barrier to entry than the dotnet framework is so the question comes up when do you use dotnet core versus dotnet framework well first of all the dotnet framework is here for a long time that's because the industry that uses dotnet is mostly still in the dotnet framework so what that means is you can't just say I'm only ever going to do dotnet core from now on dotnet framework is still a very very viable tool for development and it will be developed in for years to come Microsoft will be supporting it for years to come but for brand new development dotnet core is the way to go now there's other benefits here for the.net framework than just legacy there's also the idea there's a lot more supports out there for a dotnet framework so you have to look at what nougat packages do you want what third-party libraries do you want what third-party dll's that maybe our company dll's or Dalhousie they work with before that you have to take it upon Zeon what do they support these if they don't support net core you really can't go in that core at least not without losing that dependency on the other hand if you're looking at dotnet core versus dotnet framework the.net core side of things you've got the cross platform you've got the better faster and easier also though if you're looking to target micro services or work with docker or read some high-performance scalable systems that's where you're going to look at the the.net core side of things and start moving that direction one of the neat things about net core is one of these dependencies is the SDK what that means is what version of.net core do I depend on because that's really dependency it depends on dotnet core the cool thing is it takes that depends II with it so you package it up and deploy it somewhere it's gonna a dotnet court to to with it so that you can run dotnet core to to app right next to a dotnet core 3.0 app with no problems okay so that's something that dotnet framework has struggled with and we went to install things you had to have a dotnet framework on that machine or you had to install it well not with dotnet core because net cork goes with the application now upcoming in.net core 3.0 dotnet core is going to come to WPF and WinForms now at first you may say that's amazing we're gonna have desktop applications on Mac and Linux sorry it's not the case that's not what they're doing with with those platform because WinForms it's even even the name it depends on Windows and the same at WPF the W stands for Windows but what it will allow is it will allow that back-end code to be the easier faster better code base than the full dotnet framework that means that even if you're running desktop applications on Windows Microsoft is still saying the better choice here is dotnet core going forward so just keep that in mind as well so we've got these two different frameworks the.net core and the full dotnet framework which one you choose depends a lot on where you want to go if you're looking to get a job you're gonna wanna both because one of big things coming up for a lot of companies is how to move our dotnet framework applications over to dotnet core that's why with my timko retail manager series I'm building everything in dotnet framework which may seem counterintuitive but what I is a full set of applications there the dotnet framework so that we can simulate what you will see in the job market which is we're going to take these full dotnet framework applications and see how we can move those over a dotnet core and then see them break them apart into me micro services and use docker for some things and things like that now if you're just starting out building applications and you have build your application for yourself I would definitely recommend starting in dotnet core a lot of stuff you learn in dotnet framework is still very very valuable be this pre closed or the same as in the.net core so don't shy away from learning things if they're not dotnet core but going for with your actual development developing dotnet core if you're working in a business that uses dotnet framework definitely still learn and grow in dotnet framework but also start dabbling in dotnet course start building applications because sooner or later you're presented with the opportunity to start moving things over and you need me ready for that now one more benefit I haven't really mentioned yet but dotnet core since it can run on lengthen and Mac it can also be built on Linux and Mac that means you don't have to have Windows or Visual Studio in order to build dotnet core applications so a couple recommendations first of all if you're on a Mac there is Visual Studio for the Mac but there's also whatever platform you're on including Windows there's the S code or Visual Studio code it's free it's open source and it's one of fastest growing web tools out there because it's amazing and one of the things it can do is it can build dotnet core applications so check those out go visual studio comm you can download any of those and get started right away building dotnet core apps now I do have a course out called getting started with net core might want to check that out that's gonna go through all the different goes through console and razor page applications and MVC and API it goes through authentication it goes through so the other security stuff that's baked right into this platform it's amazing to me when I check that out on my website I have a link in the description as well but thanks for watching I hope that this kind of shed some light on the differences between dotnet core and dotnet framework and hopefully you're ready to move forward wherever you need to go alright thanks for watching as always I am Tim quarry you [Music]
Info
Channel: IAmTimCorey
Views: 522,129
Rating: 4.8291903 out of 5
Keywords: .net, C#, Visual Studio, code, programming, tutorial, course, training, how to, tim corey, C# course, C# training, C# tutorial, asp.net, .net core, asp.net mvc, asp.net core, .net core 2.2, .net core 3.0, winforms .net core, wpf .net core, vscode, vs code, visual studio for mac
Id: 79UWvR734wI
Channel Id: undefined
Length: 25min 26sec (1526 seconds)
Published: Fri Mar 15 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.