Visual Studio Team Services (VSTS) online https://www.visualstudio.com is a wonderful tool: I don’t have to build and maintain my own TFS server; the cost is nearly free; and the CI / CD (Continuous Integration and Continuous Deliver) is turning out to be a time saver…. in the long run. However I found the learning curve to be a couple of days steep, and that was painful in the middle of a project when I’m the only developer on staff, and the interface is changing as I write.
What brought me here was that my Visual Studio Solution was getting large, 17 projects, and slow. Testing, and other unknown causes was causing the Visual Studio Application to restart, destroying test results and eating time.
I started preparing Solutions containing each component of the application and its tests. My immediate goal is to upload Enterprise Employee data from Viewpoint to Namely.com, and eventually some data may become bi-directional. I’ve found that splitting out the interfaces into their own Project keeps me somewhat more honest about coding to the Interface, and tends to make my .NET Core Project using Dependency Injection a bit clearer to my own thinking.
I uploaded the lowest level Solution, “WEI.Common.Interfaces” to VSTS and started to construct a Build Definition. What I really wanted to find, and didn’t, was a simple example of what success might look like for a real production ready Solution and Build; dare I say “I’m hoping to display that for you now.”
In the .NET Core .csproj file, even if you turn off Signing, and set it as packable, some of these will come back to haunt you. Edit the .csproj file and verify these values are set, and that there is no AssemblyOriginatorKeyFile tag listed.
<PropertyGroup> <IsPackable>true</IsPackable> <GeneratePackageOnBuild>true</GeneratePackageOnBuild> <SignAssembly>false</SignAssembly> <Optimize>false</Optimize> </PropertyGroup>
Build and Release
.NET SDK 2.1.301
In order to build at other than 2.0.0, you need to specify which SDK you want used.
With the advent of .NET Core Runtime 2.1.6 I had to add a second .NET Core Tool Installer: The first being Use .NET Core Runtime 2.1.6 and the second being Use .NET Core SDK 2.1.500 (contains runtime). Note that they don’t work in the reverse order, and SDK 2.1.5 doesn’t cut it…. you need to specify 2.1.500 exactly. With these additions you may also make use of these as appropriate
<PackageReference Include=”Microsoft.AspNetCore.App” Version=”2.1.6″ />
and I suspect
<PackageReference Include=”Microsoft.NetCore.App” Version=”2.1.6″ />
Verify by running “dotnet –info” in your Package Manager Console.
You will want a Feed set up in “Build and release”, “Packages”, “+ New Feed” , and along the way you will want to add that to your Visual Studio NuGet Package Sources.
You will want to set up a release. I’ve not worked out all the bugs yet, but you have to release the package or it will continue to show as a Pre-Release package.
3. Release Pipeline
Using the pipeline you can release multiple Solutions / Builds as a set.
4. Build And Release
5. Build Definition
A couple of these steps are disabled, and you may notice that the .NET Core Tool Installer is missing, as I discovered it later.
6. Phase 1
10. Pack for Publish
I’ve found that I prefer the “Pack Options” of “Use the build number”, though you need to set the Build Definition Options “Build number format” as ‘$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) (2018-07-10 ewm)
10a. Build Definition Options
Set the Build Definition Options “Build number format” as ‘$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r) (2018-07-10 ewm)
11. Publish to Feed
12. Publish Symbols Path
13. Publish Test Results
This task is only of value if you use NUnit or other third party test extensions. If you are using [Microsoft.VisualStudio.TestTools.UnitTesting] this is unnecessary. (2018-07-10 ewm)
14. Publish code coverage
This step is only needed if you are using one of the Code Coverage Tools selectable. (2018-07-10 ewm)
15. Copy Files
16. Publish Artifact drop
17. Promote package to Release View
Not having any luck getting this task to execute successfully and auto-release new builds into the package feed. (2018-07-10 ewm)
18. Build Definition Summary
19. Build Summary