Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Before you can deploy your application, you have to create an executable file. This is done by compiling your application. Simply compiling your code is rarely enough with modern applications, however. There may be many operations you must perform to get the source ready for the compile and tasks that need to be run after the compile is finished. There are tools available to help this process. They are known as automated build tools. Visual Studio contains a build tool. You use it every time you compile, run, or debug your application from within Visual Studio. It goes by the name of MSBuild.
I'll show you how to customize your build process with Visual Studio, but first, let's look at the basic build tools. I am inside Visual Studio, and I'm going to create a new project: File > New > Project. I'm going to go to our movie chapter, which is out on our Desktop, and then I am going to create a C# console application. There it is. I'll just except the default names and click OK. Every time you press F5 to debug your application, you are actually compiling the application and then attaching a debugger.
You can see the build process here in this menu. There are two parts of this menu: The top part lists the builds items for this solution. The bottom half selects the build items for the currently selected project. So right now, since I only have one project, choosing to build the console application, or build the solution, would accomplish the same thing. I'll click Build Solution. It goes through the build process, and when you're done, I now have a compiled executable somewhere in my hard drive. If I add a second project by right- clicking on the solution and choosing Add > New Project--let's say, for this example, I want to create a Class Library, I'll call this TextLibrary and then click OK-- now when I choose Build > Build Solution is going to compile two different executables.
How do we know what build order those items will run? You can control the build order by going to your Project menu and choosing Project Build Order. Here you can see that ConsoleApplication1 is going to be built first, and then TextLibrary is going to be built second. I'm thinking that's the wrong direction. I'd like to have my library built first, and then once that's finished, I can then use to code this in that from the Console Application. So to change the build order, I can click on this Dependencies tab and say that the Console Application depends on the Text Library.
Now, if I go back to the Build Order screen, you'll see that it's reversed the order. Now, Text library will be built first, and then Console Application will be built second. There are two major types of builds you can do in an application, and they're listed in this configuration dropdown. You can see one called Debug and one called Release. Right now, I'm creating a Debug build. So the results of that are going to go in the Debug folder. Let me show you where that's at. I am going to click on this Show All Files button, I am going to open this bin folder, and right now you can see that my ConsoleApplication1.exe is in this Debug folder.
If I switch over to Release build and then compile my project, you'll see that it adds a Release folder, and it makes a copy of the release version of my executable in this folder. In a real application, you may have even more complex build requirements than this. You may need to have a test build. In that case, you can go to the Configuration Manager and add other builds in here. For instance, I can come down here and say that I have a new test configuration.
I say that in the Debug build, you're going to compile the ConsoleApplication1 with the Debug configuration. And in the Release mode, you're going to build the ConsoleApplication1 with the Release configuration. And in the Test build, you're going to build the ConsoleApplication1 with the Test configuration. Now, when I come up here and I do a build, you'll see that I end up with another folder over here, Test, and there is my ConsoleApplication1. Now this movie is just covering the basics of building your application.
If you watch the build customization movie next, you'll learn how to adapt the build scripts to your own needs and how to change which folders the physical files are stored in.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 99441 Viewers
56 Video lessons · 112673 Viewers
71 Video lessons · 81498 Viewers
131 Video lessons · 39124 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.