Monday, 29 February 2016
To add xUnit test to the solution add a Class Library (Package) project.
Edit the default project.json shown below.
Add dependency to the ASP.Net 5 web project, and to xUnit and xUnit.Runner.Final project.json should be similar to below.
Once the project.json saved the references get updated.
Let’s write a test for a very simple controller method.
Test method as a Fact (There are two types of Unit Tests in xUnit. Fact and Theory. More information here).
Go to test explorer in VS to view the test.
If you cannot see test as above build your solution. Test will be then available in the explorer. Execute and you can see the results.
Next post let’s learn how to run the unit tests (xUnit), with VS Team Service build and publish test results.
Wednesday, 17 February 2016
First requirement is to develop a poweshell script, whcih is capable of deploying, the built ASP.Net package to Azure. Information on how to write such script is available here.
Add this script to version control.
Modify our release build in previous blog to copy deploy script to build output.
Let’s create Azure Web Application as the target.
Site created and ready.
In Visual Studio Team Services, Release tab create a new empty Release Definition.
To link the release definition to the build created earlier, click on Link to a build definition.
Select the build definition and link it to release definition.
Rename the Default Environment to DevInt(Or what ever name you prefer).
In the DevInt environment create a configuratoin varibale to hold the Azure web site name.
It is possible to set approvers to the stage. So that an approval requires to get the build deploy to the stage/environment DevInt. Let’s set it to autimated and after deployment set a manual approval, to allo get it approved before deploying to next stage/enviornment in the pipeline.
In the release definition add a Azure Powershell task to execute the deployment script. Azure subscription how to link to VS Team Services account can be found here. Set the deployment script to Azure Powershell release task in Dev Int
For Web Site Name environment variable can be used in the cript arguments.
-websiteName $(WebSiteName) -packOutput $(System.DefaultWorkingDirectory)\Event.Rel\EventRelOutput\
Eventhough trigger can be set to continuous deployment like below.
Let’s leave trigger to manua for the time being.
Now you can trigger a release with the any successful build output you have using the release definition.
Build get deloyed to DevInt environment and wait for the post deployment approval.
DevInt environment site is running now.
An Improvement to the build number can be made like following.
Release name format also can be set to use build number for it to be more meaningful.
Release No $(Build.DefinitionName)-$(Build.BuildNumber)-R-$(rev:r)
Multiple environements in the pipeline can be configured.
Deployement logs in the pipeline. You can view these logs, while a release is happening.
Release history can be viewed.
Release definition change history is available as well t diagnose any issue which might have ocuured with a change to the definition.
Difference between two defnitions.
New release managment services with VS Team Services is awsome, and let’s explore more in the coming posts.
Tuesday, 2 February 2016
Building ASP.Net 4 MVC witth VS Team Services Build and deploying it to Azure web site with VS Team Services Release, is somewhat straight forward. But building an ASP.Net 5 MVC 6 (EF 7) web application with VS Team Services hosted build services, and deploying it with VS Team Services Release, requires some addtional steps.
(Asp.Net 5 is now no more and named as ASP.Net Core 1.0. It is a name change and still the ASP.Net 5 RC1 Update1 is the available version. ASP.Net Core 1.0 is not released yet.)
Let’s look at steps required to build ASP.Net 5 RC1 Update1, MVC 6 web application with Visual Studio Team Services build.
When a build is triggered with above defintition it fails giving below error.
This is because hosted build server does not have dnx Runtime packages available in it. As explained in article here use the script to download the required packages before build. Slight modification done to support the releative path of the project, with the location of the script in the verision control.
Because of a missing mistake in the path of the project.json location, in the script below error occured.
Final script here.
Release Build and Publich Artifacts
Let’s clone this CI build and create a release build. The steps to publish build artifacts for an ASP.Net 5 application is explained here. Using the script available in the article, a modification added to make it work without having a Team Project namea and releative path to project is set.
A build post step added to execute the post build ASP.Net 5 publish step and below arguments passed to script.
-projectName "BookMyEvents" -buildConfiguration $(BuildConfiguration) -buildStagingDirectory $(build.stagingDirectory)
$(build.stagingDirectory) is temporary location to publish and it is a predefined agent build variable.
Above will publish the ASP.net 5 application but it is not available to download yet.To get the published output available to download, add Copy and Publish Build Artifact step. For this specify the $(build.stagingDirectory) as the Copy Root and provide an Artifact Name. Set the Artifact Type to Server.
In the next post let’s look at how to get the ASP.Net 5 RC1 Update 1 application, deployed as Azure web application using Visual Studio Team Services Release.
SQL Server Integration Services (SSIS) projects can be created to perform ETL (Extract Transform and Load) operations. As Implementing of Co...
Generally windows services are deployed by creating an msi installer. It is possible to deploy msi via VSTS/TFS release management using the...
Task groups are really useful to share common actions with multiple build or release pipelines in Azure DevOps (VSTS). You can group multip...
GItHub has a easy way to get raw contents of a file by clicking on Raw button for any code file in GitHub, where it will redirect to url sta...
It is great if the latest updates to TFS can be applied as and when they are released. But for a large organization it might not be sometime...