Fundamentals of Projects

Introduction

A project is a group of files and resources that are compiled to produce an application. This means that, if you want to have an application, you must create a project. You have many options.

As you may know by now, an application starts from a solution, which is a file. That solution file must be contained in a solution folder. To have a working application, a solution folder must contain a project, or at least one project. A solution must be created and managed, and then a project can be added to the solution.

Practical LearningPractical Learning: Creating a Solution

  1. Start Microsoft Visual Studio
  2. In the Start Window - Visual Studio 2026 dialog box, click Create A New Project:

    Visual Studion 2026

  3. In the Create a New Project dialog box, click the arrow of the languages combo box and select All Languages:

    Create a New Project

  4. Scroll down in the list of templates and click Blank Solution

    Create a New Project

  5. Click Next
  6. In the Configure Your New Project dialog box, in the Solution Name text box, change the name to AltairEstates2
  7. Click Create

Adding a Project

To have an application, after creating a solution, you must create a project. Actually, you must add a project to a solution. You have many options.

One way to create or add a project is to work from a command prompt. A better option is to work from Microsoft Visual Studio. To start, in the Solution Explorer, right-click the name of the solution, position the mouse on Add, and click New Project... This action would display the Add A New Project dialog box.

We were previously introduced to the Create A New Project dialog box. You may remember that it displays if the user clicks Create A New Project from the Start Window. The Add A New Project dialog box has the same design as the Create A New Project dialog box.

Microsoft Visual Studio supports various types of applications, meaning many types of projects. To assist you with some details on projects, Microsoft Visual Studio provides template projects. Some of the templates you can use are for:

As you can see, you can create more than fitty types of applications using Microsoft Visual Studio. To specify the type of application you want to create (in the Create A New Project dialog box) or to specify the type of project you want to add to your solution (in the Add A New Project dialog box), you can click it in the right list. Because that list box can be long, as an alternative, you can first select the desired language in the Languages combo box. Then, in the right list, you can click the desired template application.

Practical LearningPractical Learning: Creating a Project

  1. To add a project to the current solution, in the Solution Explorer, right-click AltairEstates2 -> Add -> New Project...
  2. In the Add New Project dialog box, in the list of projects templates, click Console App:

    New Project

  3. Click Next
  4. Change the Project Name to EasternRentals
  5. In the Additional Information wizard page, in the Framework combo box, select the highest version (.NET 10.0 (Long Term Support)).
    Click Create
  6. In the Solution Explorer, right-click Program.cs and click Rename
  7. Type Listings (to get Listings.cs) and press Enter
  8. Change the Listings.cs document as follows:
    Console.WriteLine("=====================================================================================================");
    Console.WriteLine("                                 Eastern Properties Rentals");
    Console.WriteLine("-----------------------------------------------------------------------------------------------------");
    Console.WriteLine("                                       Altair Estates");
    Console.WriteLine("=====================================================================================================");
    Console.WriteLine("Prop # | Property Type | Address                | City          |  State  | ZIP-Code | Beds | Baths");
    Console.WriteLine("=======|===============|========================|===============|=========|==========|======|========");
    Console.WriteLine("770686 | Single Family | 4288 Lucow Drive       | Rockville     |    MD   |  20856   |   5  | 3.5");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("250351 | Townhouse     | 719 Beanson Road       | Arlington     |    VA   |  22201   |   4  | 3.5");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("264649 | Condominium   | 6662 16th Street NW    | Washington    |    DC   |  20012   |   1  | 1");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("975700 | Single Family | 39 Anesta Court        | Gettysburg    |    PA   |  17325   |   3  | 2.5");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("575370 | Condominium   | 10574 Spring Floor Rd  | Hinesville    |    GA   |  31313   |   2  | 2");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("747575 | Townhouse     | 228 South Gather Str   | Blanchard     |    OK   |  73010   |   4  | 3.5");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("375705 | Single Family | 8604 Bridge Stone Ave  | Brecken Ridge |    CO   |  80824   |   4  | 4.5");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("886868 | Condominium   | 2644 Swanson Drive     | Charleston    |    WV   |  25301   |   3  | 2");
    Console.WriteLine("-------|---------------|------------------------|---------------|---------|----------|------|--------");
    Console.WriteLine("694708 | Single Family | 508 North Harrison Str | Papillion     |    NE   |  68046   |   4  | 2.5");
    Console.WriteLine("=====================================================================================================");

The Recently Used Templates

On the left side, the Create A New Project and the Add A New Project dialog boxes are equipped with a label titled Recent Project Templates. If you have not worked on any solution before, below the large label is a longer label that displays "A list of your recently accessed templates will be displayed here.". If you have previously worked on at least one solution, the longer label would not display. The large label titled Recent Project Templates actually represents a list box. If you have not worked on any solution before, the left list box would be empty. If you have previously worked on at least one solution, the Recent Project Templates list box would display those types:

Create A New Project

Searching for a Template

Both the Create A New Project and the Add New Project dialog boxes are equipped with a combo box on the right side of the top title. If you know the complete or partial name of the type of project (or solution) you want to create, type it in the top combo box. A list of possible matches would display in the right list box. Here is an example:

Create a New Project - Add a New Project

The Projects of a Solution

In .NET programming, a solution is referred to as a container. As a result, a solution can contain many projects. In the previous section, we saw how to add a new project to an existing solution. In the same way, you can keep adding projects to a solution. One of the advantages of a solution is that it can contain different types of projects and projects that use various or different computer languages. After adding a project, you can manage it according to its type.

Practical LearningPractical Learning: Adding Projects to a Solution

  1. To add a project, in the Solution Explorer, right-click AltairEstates2 -> Add -> New Project...
  2. Click the arrow of the languages combo box of the Add New Project dialog box and select F#
  3. Below the combo box, make sure Console App is highlighted (if not, click Console App).
    Click Next
  4. Change the Project Name to PayrollEvaluation
  5. Click Next
  6. In the Additional Information wizard page, click Create
  7. In the Solution Explorer, below PayrollEvaluation, right-click Program.fs and click Rename
  8. Type Salaries (to get Salaries.fs) and press Enter
  9. Change the Salaries.fs file as follows:
    let firstName : string = "Emmanuel"
    let lastName  : string = "Reasons"
    let jobTitle  : string = "Accounts Manager"
    
    let hSalary   : float  = 27.86
    let monday    : float  =  9.5
    let tuesday   : float  =  8
    let wednesday : float  = 10.5
    let thursday  : float  =  9
    let friday    : float  =  8.5
    
    let timeWorked = monday + tuesday + wednesday + thursday + friday
    
    let mutable regTime   = timeWorked
    let mutable overtime  = 0.00
    let mutable regPay    = hSalary * timeWorked
    let mutable overPay   = 0.00
            
    if timeWorked         >  40.00 then
        regTime           <- 40.00
        overtime          <- timeWorked - 40.00
        regPay            <- hSalary    * 40.00
        overPay           <- hSalary    * 1.50 * overtime
    
    let netPay = regPay + overPay;
    
    printfn "===================================================="
    printfn "Payroll Evaluation"
    printfn "===================================================="
    printfn "Employee Information"
    printfn "----------------------------------------------------"
    printfn "Full Name:       %s %s" firstName lastName
    printfn "Account Manager: %s" jobTitle
    printfn "Hourly Salary:   %0.2f" hSalary
    printfn "===================================================="
    printfn "Time Worked Summary"
    printfn "--------+---------+-----------+----------+----------"
    printfn " Monday | Tuesday | Wednesday | Thursday | Friday"
    printfn "--------+---------+-----------+----------+----------"
    printfn "%6.2f  | %6.2f  | %7.2f   | %7.2f  | %6.2f"
            monday tuesday wednesday thursday friday
    printfn "========+=========+===========+==========+=========="
    printfn "                                 Pay Summary"
    printfn "----------------------------------------------------"
    printfn "                                 Time      Pay"
    printfn "----------------------------------------------------"
    printfn "                     Regular:%8.2f %9.2f" regTime regPay
    printfn "----------------------------------------------------"
    printfn "                     Overtime:%7.2f %9.2f" overtime overPay
    printfn "===================================================="
    printfn "                     Net Pay:%18.2f" netPay
    printfn "===================================================="
  10. To add a project, in the Solution Explorer, right-click AltairEstates2 -> Add -> New Project...
  11. Click the arrow of the languages combo box of the Add New Project dialog box and select Visual Basic
  12. Below the combo box, make sure Console App is highlight it (if not, click Console App).
    Click Next
  13. Change the Project Name to MachinesDepreciations
  14. Click Next
  15. In the Additional Information wizard page, click Create
  16. In the Solution Explorer, below MachinesDepreciations, right-click Program.vb and click Rename
  17. Type Equipment (to get Equipment.vb) and press Enter
  18. Change the Equipments.vb document as follows:
    Module Program
        Sub Main(args As String())
            Dim cost
            Dim type
            Dim make
            Dim model
            Dim period
            Dim bookValue
            Dim salvageValue
            Dim estimatedLife
            Dim depreciationRate
            Dim yearlyDepreciation
    
            period = 1
            Console.WriteLine("Machines Depreciation")
            Console.WriteLine("=======================================================================")
            Console.WriteLine("Enter the required values")
            Console.WriteLine("-----------------------------------------------------------------------")
            Console.Write("Type of Machine:          ")
            type = Console.ReadLine()
            Console.Write("Manufacturer:             ")
            make = Console.ReadLine()
            Console.Write("Model:                    ")
            model = Console.ReadLine()
            Console.Write("Machine Cost:             ")
            cost = Console.ReadLine()
            Console.Write("Salvage Value:            ")
            salvageValue = CDbl(Console.ReadLine())
            Console.Write("Estimated Life:           ")
            estimatedLife = CInt(Console.ReadLine())
    
            depreciationRate = 100.0# / estimatedLife
            yearlyDepreciation = SLN(cost, salvageValue, estimatedLife)
    
            bookValue = cost
    
            Console.WriteLine("=======================================================================")
            Console.WriteLine("Machine/Device:   {0} {1} {2}", make, model, type)
            Console.WriteLine("=======================================================================")
            Console.WriteLine("Depreciation Schedule")
            Console.WriteLine("=======================================================================")
            Console.Write("     Depreciation" & vbTab & "  Yearly" & vbTab & vbTab & vbTab & "Accumulated" & vbCrLf)
            Console.Write("Year" & vbTab & "Rate" & vbTab & vbTab & "Depreciation" & vbTab & "Book Value " & vbTab & "Depreciation" & vbCrLf)
            Console.WriteLine("=======================================================================")
    
            Do
                Console.WriteLine(" " & period & vbTab & FormatNumber(depreciationRate, 2) & "%" & vbTab & vbTab &
                                  FormatNumber(yearlyDepreciation) & vbTab & vbTab &
                                  FormatNumber(Format(bookValue - (yearlyDepreciation * period), "#")) & vbTab &
                                  FormatNumber(yearlyDepreciation * period))
                Console.WriteLine("-----------------------------------------------------------------------")
                period = period + 1
            Loop Until period = estimatedLife + 1
        End Sub
    End Module

Executing a Project

Introduction

In previous lessons, we saw how to execute a project to see its results. As a matter of fact, you can execute a project using the main menu of Microsoft Visual Studio, the Solution Explorer, or a shortcut.

Practical LearningPractical Learning: Executing a Project

The Default Project of a Solution

If you have a solution that contains more than one project, one of the projects is referred to as the default project. In the Solution Explorer, the name of the default project is in bold characters. If you have a solution that contains many projects, if you simply execute the application, the default project would execute. If you want to execute another project, one solution is to designate that project as the default one.

Practical LearningPractical Learning: Setting the Default Project of a Solution

  1. In the Solution Explorer, right-click PayrollEvaluation and click Set As Default Project
  2. To execute, on the main menu of Microsoft Visual Studio, click Debug and click Start Without Debugging:
    ====================================================
    Payroll Evaluation
    ====================================================
    Employee Information
    ----------------------------------------------------
    Full Name:       Emmanuel Reasons
    Account Manager: Accounts Manager
    Hourly Salary:   27.86
    ====================================================
    Time Worked Summary
    --------+---------+-----------+----------+----------
     Monday | Tuesday | Wednesday | Thursday | Friday
    --------+---------+-----------+----------+----------
      9.50  |   8.00  |   10.50   |    9.00  |   8.50
    ========+=========+===========+==========+==========
                                     Pay Summary
    ----------------------------------------------------
                                     Time      Pay
    ----------------------------------------------------
                         Regular:   40.00   1114.40
    ----------------------------------------------------
                         Overtime:   5.50    229.84
    ====================================================
                         Net Pay:           1344.25
    ====================================================
    
    Press any key to close this window . . .

Executing a Specific Project

If you have a solution that contains more than one project, at any time, you can execute any project of your choice. This is done from the Solution Explorer.

Practical LearningPractical Learning: Executing a Specific Project

  1. In the Solution Explorer, right-click MachinesDepreciations -> Debug -> Start Without Debugging
  2. When requested, enter the values as follows and press Enter after typing each:
    Machines Depreciation
    =======================================================================
    Enter the required values
    -----------------------------------------------------------------------
    Type of Machine:          Business Printer
    Manufacturer:             Xerox
    Model:                    AltaLink C8130
    Machine Cost:             6500
    Salvage Value:            1000
    Estimated Life:           8
    =======================================================================
    Machine/Device:   Xerox AltaLink C8130 Business Printer
    =======================================================================
    Depreciation Schedule
    =======================================================================
         Depreciation         Yearly                        Accumulated
    Year    Rate            Depreciation    Book Value      Depreciation
    =======================================================================
     1      12.50%          687.50          5,813.00        687.50
    -----------------------------------------------------------------------
     2      12.50%          687.50          5,125.00        1,375.00
    -----------------------------------------------------------------------
     3      12.50%          687.50          4,438.00        2,062.50
    -----------------------------------------------------------------------
     4      12.50%          687.50          3,750.00        2,750.00
    -----------------------------------------------------------------------
     5      12.50%          687.50          3,063.00        3,437.50
    -----------------------------------------------------------------------
     6      12.50%          687.50          2,375.00        4,125.00
    -----------------------------------------------------------------------
     7      12.50%          687.50          1,688.00        4,812.50
    -----------------------------------------------------------------------
     8      12.50%          687.50          1,000.00        5,500.00
    -----------------------------------------------------------------------
    
    Press any key to close this window . . .
  3. Close the DOS window and return to your programming environment

Fundamental Files of Projects and Solutions

A File for a Project

When you create or add a project, Microsoft Visual Studio automatically creates an XML file for that project. If you are working on a C# project, the file has the extension "csproj". You can open that file using any text editor, including Notepad. Here is an example:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>

For a Visual Basic project, the extension of the project file is "vbproj". For a C++ project, the extension is "vcxsproj". For an F# project, the extension is "fsproj". For a Python (including Flask, Django, and Bottle, which are supported in Microsoft Visual Studio) project, the extension is "pyproj". For a JavaScript-based project (React, Angular, and Vue), the extension is "esproj". By the way, the contents of the project files are different and they depend on the type of project.

The project file is a configuration file that assists the compiler. There is hardly any reason you will want to manually change the content of this document.

A File for a Solution

As seen in our introduction to solutions, remember that when you create a solution, the compiler automatically generates an XML file (".slnx") that contains a simple element named Solution. Here is an example:

<Solution />

If you add a project to a solution, if you build or execute the project, the compiler creates and adds an element for that project in the ".slnx" file. Here is an example:

<Solution>
  <Project Path="EasternRentals/EasternRentals.csproj" />
</Solution>

If you create or start a project in Microsoft Visual Studio, the solution is created and a project is automatically added to the solution. In this case, an XML element for the project is automally created in the ".slnx" file.

In the same way, every time you add a project to a solution (and build or execute the solution), the compiler updates the ".slnx" file. Here is an example:

<Solution>
  <Project Path="EasternRentals/EasternRentals.csproj" />
  <Project Path="MachinesDepreciations/MachinesDepreciations.vbproj" Id="e13fe758-0d33-4783-9f66-19fea5cf26d6" />
  <Project Path="PayrollEvaluation/PayrollEvaluation.fsproj" Id="72e69615-d5ca-479c-b158-a599082be429" />
</Solution>

Also, if you create or add a project, the compiler opens the DocumentLayout.json file and creates a child for the Documents element. That child is created for the project. That child element is made of two sub-elements named AbsoluteMoniker and RelativeMoniker respectively. That Documents-child is created for each project. This means that that Documents-child contains a combination of AbsoluteMoniker and RelativeMoniker sub-elements for each project.

Enhancing a Project

Introduction

When yoou start a project, whether using command prompt or Microsoft Visual Studio, a few files are automatically generated for you. Those files serve only as a foundation. They can be used useful as a starting point. Of course, they can be executed and produce a working application, but such an application is hardly useful to regular users since they produce only a Hello World sentence on the screen. Therefore, you usually have to enhance the project by adding files, writing codes, and performing other types of operations.

Practical LearningPractical Learning: Enhancing a Project

  1. Save the following files to your computer: Exercise.cs, Employee.cs, Repository.cs
  2. On the Standard toolbar of Microsoft Visual Studio, click the down-pointing arrow of the New File button. From the list that appears, click New Project/Solution:

    New File

  3. In the Start Window, click Create A New Project
  4. In the Create a New Project dialog box, click the arrow of the languages combo box and select All Languages
  5. In the top combo box, type solution. In the list of matches, click Blank Solution

    Create a New Project

  6. Click Next
  7. In the Configure Your New Project dialog box, in the Solution Name text box, change the name to CollegeParkAutoRepair
  8. Click Create
  9. To add a project, in the Solution Explorer, right-click CollegeParkAutoRepair -> Add -> New Project...
  10. In the Add New Project dialog box, in the Languages combo box, select C#
  11. In the list of projects templates, click Windows Forms App
  12. Click Next
  13. In the Configure Your New Project wizard page, Change the Project Name to PayrollEvaluation
  14. Click Next
  15. In the Framework combo box, select the highest version (.NET 10.0 (Long Term Support)).
    Click Create
  16. To create a folder, in the Solution Explorer, right-click PayrollEvaluation -> Add -> New Folder
  17. Type Models

Adding a File to a Project

As mentioned already, a project starts with at least one fundamental file. In C#, that primary file is usually named Program.cs. In most cases, to have a professional application, you would add files to the projects, including code files, help files, etc. In previous lessons, we saw how to create files, sometimes by creating a class. You can also add files that use other languages: XML files, JSON files, etc. You saw that you can create a file by using the main menu (File or Project) or by right-clicking something in the Solution Explorer (the solution, a project, or a folder) and using the Add menu item.

If you start creating a file from the main menu (File or Project) or the Solution Explorer, you are expected to complete the file by writing code in the document. As an alternative, you can use a file created by someone else with code that is ready to be used. In this case, you would import an existing code. Of course, you should have the file in your computer or you should know one way or another how you would access that file.

ApplicationPractical Learning: Adding Files to a Project

  1. To add a file, in the Solution Explorer, right-click PayrollEvaluation -> Add -> Existing Item...
  2. Locate and select the Exercise.cs file you had saved in your computer and select it
  3. To add another file, in the Solution Explorer, right-click Models -> Add -> Existing Item...
  4. Select the Employee.cs file you had saved in your computer and select it
  5. To add another file, in the Solution Explorer, right-click Models -> Add -> Existing Item...
  6. Select the Repository.cs file you had saved in your computer and select it
  7. In the Solution Explorer, below PayrollEvaluation, double-click Program.cs
  8. In the Program.cs document, replace Form1 with Exercise:
    namespace PayrollEvaluation
    {
        internal static class Program
        {
            /// <summary>
            ///  The main entry point for the application.
            /// </summary>
            [STAThread]
            static void Main()
            {
                // To customize application configuration such as set high DPI settings or default font,
                // see https://aka.ms/applicationconfiguration.
                ApplicationConfiguration.Initialize();
                Application.Run(new Exercise());
            }
        }
    }
  9. To test the project, in the Solution Explorer, right-click PayrollEvaluation -> Debug -> Start Without Debugging
  10. In the Employee # text box, type one of the employee numbers from the list:
    927594
    429272
    394131
    379492
    740317
    503582
    483794
  11. Press Tab. Here is an example:

    Payroll Evaluation

  12. To test the caulations for regular times, enter some values in the days text boxes. Here are examples:
    Week 1
        Monday:    8
        Tuesday:   7.5
        Wednesday: 6
        Thursday:  7.5
        Friday:    6.5
    Week 2
        Monday:    7
        Tuesday:   8
        Wednesday: 6
        Thursday:  6
        Friday:    8

    Payroll Evaluation

  13. Click the Calculate button:

    Payroll Evaluation

  14. To test the overtime calculations, replace the values in the text boxes for days worked. Here are examples:
    Week 1
        Monday:    8
        Tuesday:   10.5
        Wednesday: 9
        Thursday:  8
        Friday:    8.5
    Week 2
        Monday:    9
        Tuesday:   8
        Wednesday: 10
        Thursday:  8
        Friday:    10.5
  15. Click the Calculate button:

    Payroll Evaluation

  16. Close the form and return to your programming environment

Adding a Package

.

Fundamentals of Managing Projects and their Solution

Introduction

Like any item of a computer, a project is created and must be managed. Remember that a project belongs to a solution. Some details belong to a project only. The details of some projects are related to its solution. You should keep those aspects in mind when managing a project and its solution.

A Solution and a Starting Project

In the previous lesson, we saw how to first create a solution and then add some projects to it. In previous lessons, we saw that Microsoft Visual Studio allows you to create a solution and a starting project at the same time. The way we did it in our introductory lessons was that the solution and that starting project used the same name. This is fine if you are planning to have only one project in your solution. If you are planning to have a solution that contains more than one project, the solution should have its own name while each project also has its own name. You have many options. For example, as we did in the previous lesson, you can first create a solution and later add a project to it. Another option is to specify a name for a solution and a different name for the project in the Create A New Project dialog box.

Practical LearningPractical Learning: Creating a Solution and a Starting Project

  1. On the Standard toolbar of Microsoft Visual Studio, click the arrow of the New File button
  2. From the list that appears, click New Project/Solution:

    New File

  3. In the Languages combo box of the Create A New Project dialog box, select C#
  4. In the right list of the Create A New Project dialog box, click Console App
  5. Click Next
  6. In the Configure Your New Project dialog box, change the Project Name to MachinesDepreciations
  7. Change the Solution Name to CollegeParkAutoParts

    Microsoft Visual Studio - Configure Your New Project

  8. Click Next
  9. In the Additional Information wizard page, in the Framework combo box, select the highest version.
    Click Create

Practical LearningPractical Learning: Ending the Lesson

Solution 1: AltairRealtors
    Project 1: C# Console - EasternRentals
    Project 2: F# Console - Payroll Evaluation - if timeWorked > 40.00 then
    Project 3: VB Console - MachinesDepreciations - SLN
                
Solution 2: CollegeParkCorporation
    Project 1: VC# WinForms - PayrollEvaluation - Adding Files to a Project, 3 files - if (secondWeekTotalTime < 40)
    Project 2: WinForms     - StellarWaterPoint - JSON Files (WaterMeters.js, Customers.js, WaterBills.js), Forms (WaterMeters.cs, Customers.cs, WaterBills.cs)
    Project 3: React        - PayrollEvaluation - JSON File (Employees.js)
    Project 4: C# Console   - StellarWaterPoint - Water Meters - NuGet Package, EF (Classes: WaterMeter, Customer, WaterBill)
    Project 5: F# WinForms  - CollegePartAutoParts - XML File (AutoParts.xml), F# Files (AutoPartDetails.fs, StoreInventory.fs)

Previous Copyright © 2001-2026, FunctionX Sunday 04 October 2026, 12:48 Next