TGIMBA .NET Core Upgrade – Part 8 – Continuous Integration / Continuous Deployment – Part 2 – Building On Visual Studio Team Services

Git  Code Commit

Welcome back! Today, I am going to take the steps (as many as I can) and move then to a cloud provider.

I thought about using Amazon’s code pipeline. If you remember, I did one for the .NET 4.6.x The Globe In My Bucket Application(TGIMBA) release. The details on that are here:

However, Amazon did not have an out of the box .NET 4.6.x container. I could have certainly built one (I plan to for the .NET Core version…eventually), but I didn’t want to deviate from exploring what the code pipeline could do. Given that and how I felt like I kinda had to hack it together (i.e. build locally, check in the code AND runtime files and let code pipeline take it from there), I did not like the idea of using Amazon again. Based on this experience, this approach really make the code pipeline a glorified copy call. The goal of any Continuous Integration/Continuous Deployment (CI/CD) pipeline is to take the raw source files, build them, run any automated tests (a required step in my opinion) and then deploy the result to test/production/etc.

This realization and the results from my last blog post (i.e. local .bat build file) lead me to the conclusion that .NET builds are still best done in a Microsoft Environment. So, I chose Visual Studio Team Services (VSTS). To dig in, I found reference #1 invaluable.

My journey started with logging back into https://visualstudio.microsoft.com/. I have had a live account for a number of years. My personal pre-github code is all hosted here. Whatever complaints I may have about Microsoft, their developer tools are not one of them. VSTS has always worked for me 🙂

So, my steps were:

  • I logged in

1

  • Created new Team Project – Click ‘New Team Project’

2

  • Created new Team Project – Fill in and click ‘Create’

3

  • Create Build – Click ‘Setup Build’ under external repository

4

  • Create Build – Select ‘External Git’, put in your github website w/credentials (separate popup) and click ‘Continue’

5

  • Pick Template – I was not completely sure here, so I picked the .NET Core one.

6

  • Click build solution

7

  • Click ‘Queue’

8

  • Click ‘Queue’ again

9

  • Click on queued build link to watch result

10

Some of the errors I encountered with their fixes:

  • Error 1
  • Error 2
    • Compile issue – My Credentials file does not exist on github (on purpose)
    • Fix – add my database connection string as an environment variable (Reference #3)
  • Error 3
    • No test assemblies found matching the pattern: **\release\*test*.dll,!**\obj\**.
    • Fix – change pattern
      • Old value – **\$(BuildConfiguration)\*test*.dll!**\obj\**
      • New value – **\$(BuildConfiguration)\netcoreapp2.0\Test*.dll!**\obj\**

After getting the .NET Core tests to run, I got stuck.

11

The tests ran and passed, but the build threw an error stating there was something not correct with my TestsDAL.dll file. Specifically, the output from the build run is:


Starting test execution, please wait…
Error == > System.IO.FileNotFoundException: …
Passed LoginDemoUserTest
Passed RunApiIntegrationTest
Error == > System.IO.FileNotFoundException: …
Passed TestLoggerMsg
Error == > System.IO.FileNotFoundException: …
Passed TestHomeControllerIndex
Passed TestWelcomeControllerIndex
Passed RunBucketListDataV1Tests
Passed RunBucketListDataV1Tests
Passed RunMemberShipDataTests
Error == > System.IO.FileNotFoundException: …

Total tests: Unknown. Passed: 11. Failed: 0. Skipped: 0.

Error:
System.IO.FileNotFoundException: Unable to find tests for D:\a\1\s\API\bin\Release\netcoreapp2.0\TestsDAL.dll. Make sure test project has a nuget reference of package “Microsoft.NET.Test.Sdk” and framework version settings are appropriate. Rerun with /diag option to diagnose further.
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DotnetTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources)

So, I will wrap up this blog post and plan on tackling this one in my test post.

Stay Tuned!

References

  1. https://docs.microsoft.com/en-us/vsts/user-guide/?view=vsts
  2. https://social.msdn.microsoft.com/Forums/en-US/12ebeee4-e6d1-4b1c-bc01-2887f3b477b1/how-do-i-delete-a-project-created-in-visualstudio-online?forum=TFService
  3. https://www.benday.com/2016/06/06/handling-passwords-in-visual-studio-tfs-releases/
  4. https://docs.microsoft.com/en-us/vsts/pipelines/build/variables?view=vsts&tabs=batch
  5. https://stackoverflow.com/questions/37387235/asp-net-core-read-environment-variables#
  6. https://stackoverflow.com/questions/45437261/how-do-i-disable-restoring-nuget-packages-while-starting-the-solution
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s