|
| 1 | +# Creating a Project |
| 2 | +The first step will be to create a project and register our first command. |
| 3 | + |
| 4 | +## Background |
| 5 | +The following is important background information on CodeFatory itself. |
| 6 | +This will help you understand the default startup behavior the first time you create a CodeFactory project. |
| 7 | + |
| 8 | +### Nuget |
| 9 | +CodeFactory was designed to load the target versions of the SDK libraries directly from Nuget. |
| 10 | +The way that this is accomplished is by adding direct project references to the target version hosted on nuget. |
| 11 | +With the legacy project system used to host .Net framework it does not automatically pull down these nuget packages when you load the project for the first time. |
| 12 | +So if any CodeFactory project items are added you will get a number of errors related to the libraries not being loaded. |
| 13 | +The Nuget packages will automatically be pulled down the first time you do a build of the project itself, these errors will then go away. |
| 14 | + |
| 15 | +### CodeFactory Packager |
| 16 | +A CodeFactory commands project is the main execution point for all CodeFactory automation. |
| 17 | +This project will automatically execute a command line utility after the compile of the project has completed. |
| 18 | +The CFXPackager utility is responsible for building the CFX file that is used to run codefactory automation. |
| 19 | + |
| 20 | +If no commands are defined in the project this utiltity will output a error saying the package could not be built. |
| 21 | +This error will go away once the first command is added to the project. |
| 22 | + |
| 23 | + |
| 24 | +## Walk through Steps |
| 25 | +The following is the walk through for creating the project and make sure you can successfully compile the code factory project. |
| 26 | + |
| 27 | +1. Start Visual Studio 2019 |
| 28 | + |
| 29 | +2. From the What would you like to do? window click Create a new project |
| 30 | + |
| 31 | + |
| 32 | +Or you can start the same process if you dont use the start up window. |
| 33 | + - Click the File menu |
| 34 | + - From the context menu select New |
| 35 | + - From the sub context menu select Project |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +3. From the Create a new project window do the following |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + - In the search box type CodeFactory |
| 44 | + - From The list of projects select CodeFactory - Commands Library |
| 45 | + - Click Next |
| 46 | + |
| 47 | +4. From the Configure you new project do the following |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + - In the project name box type DisplayProjectCommands |
| 52 | + - Click Create |
| 53 | + |
| 54 | +5. Once the solution and project has been created you will see the project and default folder structure. I have expanded the Project folder to show you the sub folders. |
| 55 | + |
| 56 | +The following is a brief overview of the goal for each folder. |
| 57 | +Important note each explorer command has its own folder. |
| 58 | +The following structure is prescriptive only. |
| 59 | +You can create any folder structure you wish for your automation. |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + - The Project folder is where project commands are created and stored |
| 64 | + - The Dialog folder is for placement of user interface dialogs you created. |
| 65 | + - The Logic folder is where you add logic that can be reused across multiple project commands |
| 66 | + - The Template folder is where you add T4 template that as used by project commands. |
| 67 | + |
| 68 | + |
| 69 | +6. Next we will add a solution explorer project command to the project. Do the following steps. |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + - Right click on the project folder in solution explorer |
| 74 | + - From the context menu select Add |
| 75 | + - From the sub context menu select New Item... |
| 76 | + |
| 77 | +7. From the Add New Item Dialog Window do the following. |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | +- From the Visual C# Items select CodeFactory |
| 82 | +- Select Solution Explorer - Project Command |
| 83 | +- In the name box enter ProjectInformationCommand.cs |
| 84 | +- Then click Add |
| 85 | + |
| 86 | +8. A Microsoft Visual Studio error box will appear. |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +This error occurs because the CodeFactory SDK nuget packages have not been downloaded into the project yet. |
| 91 | +Click Ok to continue. |
| 92 | + |
| 93 | +9. The command code file will display in the IDE and a number of syntax errors will appear. This is occuring since we have not pulled down the SDK through nuget yet. |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | +10. We will then build the solution this will trigger the pull of the nuget packages. Do the following. |
| 98 | + |
| 99 | + |
| 100 | + |
| 101 | + - From the top navigation bar click on Build |
| 102 | + - From the context menu click Build Solution |
| 103 | + |
| 104 | +11. Once the build has completed it will have downloaded and installed the nuget packages into the project. |
| 105 | + |
| 106 | +You will now see the CodeFactorySDK reference in the project. |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +You will also notice there are no longer any errors in the project command. |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +The project creation is complete. |
| 115 | + |
| 116 | +## Next Step - Automating Project Information |
| 117 | +In the next section we will build the logic to read information about a project and display it to the user in Visual Studio. |
| 118 | + |
| 119 | +[Automate Project Information](AutomateProjectInformation.md) |
| 120 | + |
| 121 | +## Return To Create Project Guidance |
| 122 | +The link below will take you back to the create project guidance. |
| 123 | + |
| 124 | +[Create Project Guidance](Overview.md) |
0 commit comments