Ensure you have npm installed, if you don’t please read the blog Easy steps to installing Node, NPM, TypeScript, and Bower in Windows
Once installed execute the following:
npm install –g @angular/cli
To verify you have access to ng launch a command prompt and type in
If you receive a message that it is not recognized as an internal or external command, update your PATH environment variable to include the following:
Try ng --version again to see if it displays the version information. Once working create your project:
ng new your-project-name
Per guidance provided by the official Bootstrap site (excerpt below) install Jquery, Popper.js, and Bootstrap.
With npm installed (above) execute the following:
- npm install bootstrap
- npm install jquery
- npm install popper.js
Update the src/styles.css with the following:
Update the angular.json scripts section with the following:
Note: angular.json has been renamed from angular-cli.json
Now you are ready to use Bootstrap in your Angular application
- Microsoft.EntityFrameworkCore.SqlServer (for SQL Server usage)
First you’ll want to create your data context, you’ll see that mine resides in the data access layer project for my Contact Manager application; which follows best practices and patterns, but makes EF complain (video has a work-around). My context uses POCO objects from my Model project which has no references to Entity Framework or any other external libraries.
Next create the database tables by launching the NuGet Package Manager console and typing in:
- add-Migration <YourContext>
Your done! The following video demonstrates how I had a failing unit test because three were no tables in my database. With the above two steps the tables were generated.
In figure 1 we show the POCO class that generated the tables, and relationships, shown in figure 2.
Video 1 fixing failing unit test because there are tables in the database
Figure 1 Contact Class
Figure 2 Schema generated from Contact Class
Figure 3 Context code – referencing only POCO objects
If you follow the available documentation on MSDN, or on various internet sites such as StackOverflow, you’ll find the app.config configuration in figure 1; it is wrong and you’ll receive the following error:
An error occurred creating the configuration section header for unity: could not load file or assembly ‘Microsoft.Practices.Unity.Configuration…’
This sent me for a loop as I generally use the Microsoft packages for Unity, but decided that for my open source contact manager application (http://github.com/billkrat/contact-manager) that I will use the latest NuGet version and was surprised when I encountered the error shown in figure 1.
In hindsight it was a rather obvious issue/fix – but I blog about it because if you’re like me you could waste time on this because there is a blatant violation of development standards that forces us to “think outside of the box”, the “standards” box that is. The namespace does not match the assembly name, reference figure 3.
Since I didn’t add the namespaces manually (I used NuGet) I didn’t realize this until I had to start digging in deep.
Once you update the assembly in the configuration file to reflect Unity.Configuration (as shown in figure 2) you can then follow the documentation available at the Microsoft site for “The Unity Configuration Schema”; it has comprehensive documentation – you can also reference my above GitHub open source project for examples as I use it throughout the application.
Figure 1 following documentation generates error
Figure 2 proper configuration for section
Figure 3 mismatch between assembly name and its namespaces
You can use Visual Studio’s free service for continuous integration for GitHub as easily as you can for TFS. In the below clip we show how when we push our changes to GitHub, the Visual Studio CI fires processing the build.
The steps follow below:
1. Create the Visual Studio project, disregard the project setup, and go directly to the “Build and Release” link and click New.
Select “GitHub” and log into the system, select your GitHub project from the available list (using … link button)
Click continue, select the .NET Desktop build template and click “Apply”
Be sure to select “Private” default for the agent queue, otherwise you’ll be limited to Hosted free minutes (private is unlimited). Click the Manage link when done.
From the manage page, download agent to your local drive.
Note: you can simply unzip it to the agent folder using explorer (easier then using suggested PowerShell command).
Before launching PowerShell it is suggested that you click on your login icon, select Security, and then add a Personal Access Token (PAT). IMPORTANT: Be sure to copy/paste the provided token somewhere for future use – you won’t be able to uninstall/reconfigure your agent without it.
Running as admin, launch PowerShell, switch to the folder you unzipped the agent files to, and type “.\config”. You can select the default prompts as shown below. Note: since I have unit test that need to run SQL Server (using my credentials) I logged in as “BillKrat”
The last thing you’ll want to do is click on the “Triggers” link of the build definition and select “Enable continuous integration”. If you don't check this checkbox then you'll be forced to queue builds - versus it automatically generating a build upon check-in as shown in the video clip above.
When build is completed you will receive an email notification on the status.
Event after I let the installation run all night…
I used the Task Manager to exit the process and then rebooted the server. Upon restart it resumed the installation process hanging at 17% again, my internet research indicated that I had to start the Windows Server Essential Manager Service and upon doing so the installation successfully completed.
Note: I used the Task Manager, selected the services tab, and started it from there.