Exploring Downloaded Packages2:43 with Jeremy McLain
We'll crack open a package and look inside.
Now if we look at our project references, 0:00 we see that three more assemblies have been added. 0:02 A single NuGet package can contain more than one assembly. 0:05 These two came as part of the package. 0:09 And this one is actually an assembly in the .net framework that EntityFramework 0:12 needs, so it added automatically. 0:16 If we look at packages.config, 0:19 we see that our project now depends on two NuGet packages. 0:21 You might be wondering where these packages are getting downloaded to. 0:25 We can tell that by looking at the path of the assemblies that were 0:29 added to the project. 0:32 Click on the assembly name and 0:34 in the properties window scroll down to the Path property. 0:35 I'll expand this window so we can see the entire path. 0:39 As you can see, 0:43 it's inside a folder named Packages which is in our Project solution folder. 0:44 We can go there by right clicking on the solution name in the solution explorer and 0:49 clicking Open Folder in File Explorer. 0:53 Here's the packages folder. 0:56 Let's look inside, we can see that there is a folder for 0:58 each package that we've downloaded. 1:01 Let's look inside the Entity Framework package. 1:04 This is the entire contents of the package that was downloaded. 1:06 You might have expected it to just have the two assemblies that were added to 1:10 the project. 1:13 We'll briefly go through what all this stuff is. 1:15 In the future when you want to make your own packages and 1:17 upload them to the NuGet repository. 1:19 You'll want to know more about what these things are. 1:21 The lib directory contains the actual assembly files. 1:24 But wait., why are there two folders? 1:28 Turns out, the package contains different assemblies for 1:31 different versions of the .NET framework that it supports. 1:34 That's why the package.config file 1:37 has the .NET Framework version listed with each package. 1:40 The package didn't just come with assemblies. 1:44 It also came with other tools that we might need when working with 1:46 EntityFramework. 1:49 If we look in the tools directory, we see lots of files. 1:51 If you're familiar with EntityFramework, 1:54 the program migrate.exe might look familiar. 1:57 It's a console application that's used to move between versions of 2:00 a database schema. 2:03 There's also some PowerShell scripts in here. 2:04 The tools that come in a package can be run from N uGet's package manager console, 2:07 which we'll see in a bit. 2:11 NuGet packages can also add other files to the project that aren't dependencies. 2:13 The content folder contains these files. 2:17 It can even change the configuration of the application that it's added to. 2:20 That's what these two transformation files do. 2:24 Back in Visual Studio, if you look at the app.config file for 2:27 Json to DB we'll see a configuration block named EntityFramework. 2:30 This was added when EntityFramework package was installed. 2:35 As you can see, NuGet can do more than just add references to assemblies. 2:39
You need to sign up for Treehouse in order to download course files.Sign up