.NET Maui Apps | How to install and re-use already installed NuGet packages into new project.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends and everyone you're welcome back  to netcode app Channel this video I'm going to   show you how to reuse and installed package  from another project you see when you have   a new project created you have to install some  package that you want to use but what if in case   you have installed the package on a separate  project already what can you do then you can   reuse that package then you get package so it  doesn't necessarily mean that anytime that you   create package you create projects you have to  go in there and install the same nuget packages   that you have installed already in your old  project so in this video Let's Take a look   on how to reuse those packages now as you can  see I have a project created and I've installed   community2k.mvvm package so if I go to um demo  and if I go to the properties for this demo   let's say so if I come here you can see  I have it down here as an item group   so you can see I have a community2k.mbvm the  Verizon is 8.2.1 now I have this package installed   to this project so that's what I'm gonna do I'm  going to copy this then I'll just go for note so Notepad then let me paste this  package here now I'm going to close this now I have this so I'm going to open  a new package here and now with this   I'm going to create a new project that is  the same project so create a new project so we're going to create.net marry  app projects from the template here   so we're going to search for Murray so that  net marry app and here is going to be demo one now you can choose the location now click on next choose framework and that  is 7.0 because when you check the app free   version we use 7.04.net framework so  maybe you can decide to keep that or   you can change it so let's keep  the 7.0 and I'll click on create so now let's find this project  and see what we have now okay so now we have the app ready and it is   running when you go to the  properties of this project now this project properties contains only one  package that is a default one now we have the   package that you want to load we have installed  it already so we have it on our machine and now   we want to load this packet to this project so how  can we do that you want to load only the first one   so in order to do that we have to first  unload the project so let's stop this   and now click on the project and then go to  unload project so now unload project we are in the   settings now now let's go in there and uh grab the  project so let's grab the package that you want   to add that is this one let's come to the project  item group and now let's add this let's save this and now you see when you come to the same settings  again we have the the item group of the package   here now let's load the project with dependencies  so reload project with dependencies click on this   and now you see the project the package  is still there go to dependencies and   now let's see what we can do we have to  build this so dependencies let's go to the   packages and I can see we have this package over  here and it is included now now let's build this   package and let's build this project  and see so we first have to clean this   then when we are done we build a project so now  done let's clean solution two so clean solution and now let's build the project so build this so builds I see that now let's run this project okay so it has run successfully now let's test  with the package that we installed let's start   with the package or a simple um view so let's  see you can see we have the main page here let's   try to create and a content and also view model  because you install the community toolkit.mvvm so   let's test it with an um a collective view here  so I'm going to go to the project now let's add   let's stop this debugging and I'm going to add  a class and maybe we can use this as customer so let's have customer name so that is public and now here we're gonna have ID and we're gonna have name two so let's see customer this is string and that would  be name okay this is what we have let's create our view model so we create a class and  now we say this is main page view model now in this let's inherit from observable   objects and observable object is a class found  in the package that we install Community toolkit   so if let's see if it will be able  to work here so observable object okay now let's create a Constructor for this let's create so public observable collection then we say customer let me say customers new now let's call the method  so let's say load customers low defaults customers let's call that  method and now in here let's create this method over here so let's say customers Dot so here must be customers so  customers dot add then new customer   you have an ID of one we have name of John Doe let's add few ones so new customers so ID is equal  to and our name is equal to let's add one more so customers dot add then we have new customer we have id43 then half name is equal to okay now let's say we have this data that you want  to use in the collection view so when this page is   called we're gonna call this method and this  means I'm going to load this customer so this   data to this customer object collection let's  inject this into the content page and that is   the main page.cs so let's click this button  that's the default one or we can maintain it   so let's click this and now in here let's  inject this and I will say binding contest records you this main page let's clear this now we are saying that it is  inaccessible because let's   go to the main page so here  must be public partial class foreign class now let's go back to the main page  and this one is off let's register the   view model and its view in the program CS  file so we say Builder dot Services dot add transient and now we have  to say main page view model and let's have one again so that Services dot  app transient and I will say main page view model let's go to our main page  and now let's clear all this now we're gonna use collection View and I  will say hello Sim view dot item template then we're going to say data templates so yeah let's use an item source and item Source here before we can have this  let's bind the namespace here so if you murder and now we say it is namespace and that is demo one so  this let's specifically specify   the data type so X data type that you  want and that is main page view model so main page view model that's what you want now  when you come here you can ask bind the queue so   we say binding then you can have customers now  with a data template let's specify the data type 2   and before we do that you can use this view model  so let's set this to local so this looka we can't   use this local here and now data type so you're going  to say local Dot and I'm gonna have   um customer now let's specify label and now let's see before we do that  let's get free let's have background and inside the frame let's put  our model oh that's the label   and let's specify the test  so we bind it to the name okay so we can we bind this to  the name now let's save this   and let's find this application  and see what we have okay so let's see all right so you see we have  the data here so it means that although we did   not download the community toolkit.ng get package  but we have been able to use it in a current or   new project because we have downloaded it  already now when you download any package   that we installed it goes to your local disks  you can see when you go the easiest folder and   you're gonna have this nuget package when you  open it you're gonna have a lot of packages   that you have installed so coming to 2kwbm here  it is installed already so all these packages   what I need to do here is I have to keep the item  group I can just go there and grab the reference   here and keep them anytime that I create a new  project I just unload it add it and I reload it   with dependencies and you're good to go so that  is a way to prevent downloading packages anytime   that you create a new project once you have  these packages installed or downloaded already   I believe this video is helpful yes so that is  it for this video thank you guys for watching   if you like what I'm doing please give me thumbs  up subscribe to the channel too so that as soon   as I create a new informative lesson you have  the notification to watch it also check the   playlist we have a lot of lessons and projects  for you you can just go in there and I'll take   any of them thank you take care of yourself  and I'm going to catch you up in the next video
Info
Channel: Netcode-Hub
Views: 325
Rating: undefined out of 5
Keywords: skip(), scaffolding, assign-role, mobile apps, maui app, mobile app, desktop app, create app, android, apk, applications, MSIX, poweshell, cli, command-prompt, google api key, map key, google map api key, cloud key, direction, maps, integrate map, desktop application, google map.api key, api key, context menu, navigation service, nivigate trough content pages using navigation service, How to use Font Awesome in NET MAUI Mobile and Desktop applications., fontawesome, icons
Id: l7jaqjuJnzI
Channel Id: undefined
Length: 15min 0sec (900 seconds)
Published: Wed Aug 09 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.