Building2:16 with Jeremy McLain
Learn how to build a project so it can be deployed, distributed, and/or run.
Up until now, 0:01 we've been executing the code from within the IDE using the debugger. 0:01 Eventually, you want to build your application and publish it somewhere, 0:06 distribute it, or in the very least, run it without using Visual Studio. 0:09 When I click the Start button here, 0:14 Visual Studio will first build the solution before running the program. 0:16 When it builds the solution, all of the files needed to run the program 0:20 are copied into a special folder inside the project directory called bin. 0:24 Bin is short for binary, so you might hear people call this the bin directory. 0:29 The point is, this is where you go to find your application. 0:33 You can run it from the bin directory, move it to another directory, or even 0:37 another computer so long as that computer has the same version of .NET and MONO. 0:41 By default, Visual Studio projects come preconfigured with two types of builds, 0:46 Debug and Release. 0:51 These are called build configurations. 0:53 The Debug build configuration does things like 0:56 include information that the debugger and profilers need. 0:58 The Release build configuration, among other things, 1:02 applies compile time optimizations to make the code run faster. 1:05 You can switch between build configurations here in this drop-down. 1:10 Switching to Release build disables the debugger. 1:14 So, if we attempt to run the debugger with this set to release, 1:17 we'll see this message. 1:20 We're still able to continue running the code, but 1:22 none of the break points will be hit. 1:25 You can build the code without running the debugger by clicking on build solution in 1:27 the build menu. 1:31 Now let's take a look at what it did. 1:35 The easiest way to get to the bin directory is to right click on the project 1:37 in Solution Explorer and click on Open Folder in File Explorer. 1:42 Here we see the bin directory. 1:50 In here, we find two directories. 1:52 Each named for a build configuration. 1:54 For this c sharp console app, 1:57 both directories contain the same types of files. 2:00 Here we see the file with the .exe extension. 2:03 That's our executable file which we can copy around. 2:06 These other files here are not required for 2:10 the program to run, most of them are only used by Visual Studio. 2:12
You need to sign up for Treehouse in order to download course files.Sign up