<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>DI</title><link>http://www.ralbu.com:80/di</link><description>DI</description><item><title>A logging library for operations or a C# feature which Java developer will appreciate</title><link>http://www.ralbu.com:80/a-logging-library-for-operations-or-a-c-feature-which-java-developer-will-appreciate</link><description>&lt;p&gt;&lt;sub&gt;&lt;/sub&gt;&lt;sub&gt;&lt;/sub&gt;This blog is not about how Java is better than C# or vice versa. It's about using existing features a language offers you - every language has its own strength.&lt;/p&gt;
&lt;p&gt;I went to &lt;a href="http://www.meetup.com/London-Continuous-Delivery" target="_blank"&gt;London Continuous Delivery&lt;/a&gt; meetup a few weeks ago where &lt;a href="https://twitter.com/seanjreilly" target="_blank"&gt;Sean Reilly&lt;/a&gt; presented a logging library with operations in mind - &lt;a href="https://github.com/EqualExperts/opslogger"&gt;opslogger&lt;/a&gt;. The library is created in Java and one of the questions was when it will be ported in .NET. In .NET we don't have to create a library for this purpose, we can extend existing libraries applying what C# language offers. If you&amp;rsquo;re a .NET developer then extension methods shouldn&amp;rsquo;t be new to you but if you&amp;rsquo;re an ops guy show this article to your devs.&lt;/p&gt;
&lt;p&gt;The main idea of the library is that it does logging for operations. I really liked it and agree with the fact that people who look after our apps are left behind in terms of what to log. Although I think the logging is for both operations and developers. The first look after the performance and the behaviour and the latter came to the scene for troubleshooting.&lt;br /&gt;The library is very opinionated, for example, you can't use different levels - there is just one level. You either log or you don't. There's no log rotation, and I agree with what Sean is saying that devops know how to configure it so you don't need a tool to do that. But, how about the applications you deploy on clients machines? In .NET world that will be Windows Forms and WPF applications. You need log rotation and you need different levels - you don't want to log everything every time on a client machine. Also, I like having different methods for logging: debug with some me&lt;sub&gt;&lt;/sub&gt;&lt;sub&gt;&lt;/sub&gt;ssage and object to be serialized as parameters and a different method to log exception with Exception instance. For example:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;Log.Debug("Request info", request);
Log.Error("Exception when executing payment", ex);&lt;/pre&gt;
&lt;p&gt;The idea I liked in the framework is that you don't log random messages but you have a set of predefined identifications plus your log message. For example, every time the application starts you log:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;APP-001 Application started.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The code in the opslogger library looks like this:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;logger.log(START_APP, "Application started.");&lt;/pre&gt;
&lt;p&gt;and START_APP is an enum with value "APP-0001"&lt;/p&gt;
&lt;p&gt;&amp;nbsp;If you're a .NET developer you know we can easily implement the same approach using existing logging libraries and extension methods. We have nice logging libraries with a vast amount of features. Why should we create one just for logging specific messages? What opslogger library does is that it uses a set identification messages.&lt;/p&gt;
&lt;p&gt;I used to use log4net in the past, but I switched to NLog. If you're still using log4net I definitely recommend to have a look at NLog. In this example I will use NLog.&lt;/p&gt;
&lt;p&gt;I have created a sample ASP.NET MVC application to prove the idea. You can find it on &lt;a href="https://github.com/ralbu/nlog-extension"&gt;github&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We're going to extend NLog with a set of predefined methods with specific messages. For example:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt; public static class LoggerExtension
    {
        public static void ActionInit(this ILogger logger, string message)
        {
            logger.Debug($"APP-001 {message}");
        }
        public static void Performance(this ILogger logger, string message)
        {
            logger.Debug($"PERFORMANCE-001 {message}");
        }
    }
&lt;/pre&gt;
&lt;p&gt;And we'll use it like that:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;Logger.ActionInit("HomeController Index");&lt;/pre&gt;
&lt;p&gt;Have a look at log output below. You can see that it's easy to search for particular messages. Let's say you want to filter all the performance logs, in this case you use &lt;em&gt;PERFORMANCE-001&lt;/em&gt; tag and depending what system you use to store logging you can have a nice filter/view of the data.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:04:26.1665|DEBUG|NLogExtension.Controllers.HomeController|APP-001 HomeController Index&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:04:26.1860|DEBUG|NLogExtension.Controllers.HomeController|Get all users&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:04:26.8906|DEBUG|NLogExtension.Controllers.HomeController|&lt;strong&gt;PERFORMANCE-001 Getting users in: 700&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:04:26.8946|DEBUG|NLogExtension.Controllers.HomeController|Searching for active items&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:04:27.1998|DEBUG|NLogExtension.Controllers.HomeController|&lt;strong&gt;PERFORMANCE-001 Searching active items in: 301&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:04:27.2478|DEBUG|NLogExtension.Controllers.HomeController|Sample debug message&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:06.0037|DEBUG|NLogExtension.Controllers.HomeController|APP-001 HomeController Index&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:06.0322|DEBUG|NLogExtension.Controllers.HomeController|Get all users&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:06.7354|DEBUG|NLogExtension.Controllers.HomeController|&lt;strong&gt;PERFORMANCE-001 Getting users in: 700&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:06.7464|DEBUG|NLogExtension.Controllers.HomeController|Searching for active items&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:07.0559|DEBUG|NLogExtension.Controllers.HomeController|&lt;strong&gt;PERFORMANCE-001 Searching active items in: 300&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:07.0559|DEBUG|NLogExtension.Controllers.HomeController|Sample debug message&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:07.5652|DEBUG|NLogExtension.Controllers.HomeController|APP-001 HomeController About&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;2016-03-10 14:10:08.8938|DEBUG|NLogExtension.Controllers.HomeController|APP-001 HomeController Contact&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you can see we can achieve the same output as opslogger with any logger library we want in a very flexible way.&lt;/p&gt;</description><pubDate>Wed, 16 Mar 2016 10:25:33 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/a-logging-library-for-operations-or-a-c-feature-which-java-developer-will-appreciate</guid></item><item><title>Continuous Integration and Deployment of Azure Web App using VSTS / VSO</title><link>http://www.ralbu.com:80/continuous-integration-and-deployment-of-azure-web-app-using-vsts-vso</link><description>&lt;p&gt;A new addition to the Microsoft&amp;rsquo;s Visual Studio Team Services (former VSO) continuous integration and deployment is the Release tool. The CI/CD process I&amp;rsquo;m describing here applies to VSTS but at some point it will be released to TFS as well. Microsoft invested its effort into building a nice continuous integration and deployment pipeline. The new online VSTS build and release tools are much better than the old XAML builds. I have been working with &lt;a href="https://www.jetbrains.com/teamcity/" target="_blank"&gt;TeamCity&lt;/a&gt; for a very good number of years and I was surprised with Microsoft&amp;rsquo;s new addition. I started working with Build and Release tools very earlier for one of our clients -&amp;nbsp; since private previews. It was called Visual Studio Online at that time. My experience is that they are moving very fast. I ported a few of our TeamCity builds and deployment configurations over to VSTS and it was easier than I expected. Taking into the account that I almost had zero documentation I progressed very quickly.&lt;/p&gt;
&lt;p&gt;In this article I will explain how you can build and deploy a Web site into Azure Web App. VSTS contains a template for Azure Web Sites which makes our life easier. It contains Cloud Services and IIS Web Applications also. And if there&amp;rsquo;s anything you need which is missing you can always use PowerShell.&lt;/p&gt;
&lt;p&gt;The solution we&amp;rsquo;re going to deploy represents an ASP.NET MVC Application but a WebForms application will have the same approach. For the sake of simplicity I created an ASP.NET MVC Application and named it &lt;strong&gt;OfficeInventory&lt;/strong&gt;.&lt;/p&gt;
&lt;h1&gt;Create a build configuration&lt;/h1&gt;
&lt;p&gt;Open Build tab in VSTS and click the plus button:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/add-build_2.png"&gt;&lt;img title="add-build" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="add-build" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/add-build_thumb.png" height="364" border="0" width="392" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Select an Empty template in the popup windows and click Next. There is a &lt;strong&gt;Visual Studio&lt;/strong&gt; Template but it will add build steps which we don&amp;rsquo;t need, like Visual Studio Test and Index Sources.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/select-empty-template_2.png"&gt;&lt;img title="select-empty-template" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="select-empty-template" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/select-empty-template_thumb.png" height="484" border="0" width="483" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the next step select the source settings. Default agent in this case will be Hosted, unless you&amp;rsquo;ve installed your own agent. With the hosted agent you have 240 free minutes per month. Check Continuous Integration check box and click Create.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/configure-source-control_2.png"&gt;&lt;img title="configure-source-control" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="configure-source-control" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/configure-source-control_thumb.png" height="484" border="0" width="486" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;First we&amp;rsquo;ll configure the build and after that we&amp;rsquo;ll add build steps.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Repository configuration&lt;/h2&gt;
&lt;p&gt;We&amp;rsquo;ll come back and update the build and publish build steps but for the moment open the &lt;strong&gt;Repository&lt;/strong&gt; tab. You should have already source settings in place. The settings I&amp;rsquo;m explaining below refer to a Git repository. If you want the build process to download all the source code every time it builds select true for the&amp;nbsp; &lt;strong&gt;Clean&lt;/strong&gt; dropdown. Depending how big your project is this may slow down the build process. If you want to tag your source code then select the appropriate value in the &lt;strong&gt;Label sources&lt;/strong&gt;. Adding tags to you build will make sense when you create NuGet packages but it will provide less information for normal builds. By default &lt;strong&gt;Label format&lt;/strong&gt; contains the build number. I will explain later how to set it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Variables configuration&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Variables &lt;/strong&gt;tab contains our variables definition we can use during the build process. We can use them in the following format:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;$(VariableName)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s add the following variables:&lt;/p&gt;
&lt;table border="0" cellpadding="2" cellspacing="0" width="400"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="200"&gt;BuildConfiguration&lt;/td&gt;
&lt;td valign="top" width="200"&gt;Release&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="200"&gt;BuildPlatform&lt;/td&gt;
&lt;td valign="top" width="200"&gt;Any CPU&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Triggers configuration&lt;/h2&gt;
&lt;p&gt;In the &lt;strong&gt;Triggers &lt;/strong&gt;tab we can configure when to run the build. You can set it up to run as &lt;strong&gt;Continuous integration&lt;/strong&gt; and include filters based on branch names. When you check &lt;strong&gt;Batch changes&lt;/strong&gt; option it will include several check-ins if they are from the same committer. You can run the build on a schedule as well. Adding the schedule will help when you want to run builds which takes more time, like testing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;General&lt;/h2&gt;
&lt;p&gt;In the &lt;strong&gt;General &lt;/strong&gt;tab you can change the Agent Queue, build authorisation, badge displayed on external web site etc. We&amp;rsquo;re interested in setting the &lt;strong&gt;Build Number&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;I like setting the build number following the classic approach: &lt;em&gt;major.minor.build.revision&lt;/em&gt;. In this case, if I want the build number to be &lt;em&gt;1.0.3.[RevisionNo]&lt;/em&gt; then I use the format &lt;em&gt;1.0.3.$(Rev:r)&lt;/em&gt;. If you prefer to use a different system to name your builds, like using date, then find more information online at this &lt;a href="https://msdn.microsoft.com/en-us/library/hh190719%28v=vs.120%29.aspx" target="_blank"&gt;MSDN link&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Retention&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Retention &lt;/strong&gt;tab allows to specify for how many days you can keep the build details, including test results. The default value is 30 days and at the moment you can&amp;rsquo;t change that.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Build steps&lt;/h2&gt;
&lt;p&gt;We have created an empty build, now lets add the configuration we need. Click &lt;strong&gt;Add build step&amp;hellip;&lt;/strong&gt; in the list of &lt;strong&gt;Tasks&lt;/strong&gt; select &lt;strong&gt;Build &lt;/strong&gt;on the left hand side and search for Visual Studio Build. Click the &lt;strong&gt;Add&lt;/strong&gt; button. Next select &lt;strong&gt;Utility&lt;/strong&gt; on the left hand side and click the &lt;strong&gt;Add &lt;/strong&gt;button of the &lt;strong&gt;Publish Build Artifacts&lt;/strong&gt;. Now you can close the popup.&lt;/p&gt;
&lt;h3&gt;Build solution&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s go back to the &lt;strong&gt;Build &lt;/strong&gt;tab and select &lt;strong&gt;Visual Studio Build.&lt;/strong&gt; We need to provide settings on the right hand side. First of all, you may want to add a meaningful name to this step, so click on the pencil in the right hand side, above all the settings and enter the name you want.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Solution&lt;/strong&gt; text box contains **\*.sln &amp;ndash; you can leave it like that or click on the ellipsis button and select the solution file from the tree.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;MSBuild Arguments &amp;ndash; &lt;/strong&gt;we need to create a package which we&amp;rsquo;ll deploy later in Azure Web App. In order to do this we&amp;rsquo;ll use the command line&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=$(Build.StagingDirectory)\OfficeInventory&lt;/pre&gt;
&lt;p&gt;Pay attention to the &lt;strong&gt;PackageLocation&lt;/strong&gt; parameter. This is where our package will be copied. We&amp;rsquo;ll use this path in the next step to publish the package. We use &lt;em&gt;Build.Staging&lt;/em&gt; variable which is a predefined build variable. The package will be copied to staging directory of our build and in the &lt;em&gt;OfficeInventory &lt;/em&gt;folder. The staging folder is generated by the build agent.&amp;nbsp; Find more information about build and release variables at &lt;a title="Use variables" href="https://msdn.microsoft.com/en-us/Library/vs/alm/Build/scripts/variables" target="_blank"&gt;Use variables&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For the &lt;strong&gt;Platform &lt;/strong&gt;and &lt;strong&gt;Configuration &lt;/strong&gt;provide the variables we&amp;rsquo;ve created before: &lt;em&gt;$(BuildPlatform)&lt;/em&gt; and &lt;em&gt;$(BuildConfiguration)&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Check the &lt;strong&gt;Clean &lt;/strong&gt;checkbox if you want to start the build with all the files removed from previous builds.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-vs-settings_2.png"&gt;&lt;img title="build-vs-settings" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="build-vs-settings" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-vs-settings_thumb.png" height="351" border="0" width="804" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Publish package&lt;/h3&gt;
&lt;p&gt;The next step is to publish the package so we can use it during the Release process. Select the &lt;strong&gt;Publish Build Artifacts &lt;/strong&gt;step. In the &lt;strong&gt;Path to Publish &lt;/strong&gt;enter &lt;em&gt;$(Build.StagingDirectory)\OfficeInventory. &lt;/em&gt;For the &lt;strong&gt;Artifact Name &lt;/strong&gt;provide a name you want. In my case it&amp;rsquo;s &lt;strong&gt;OfficeInventory&lt;/strong&gt;. In the &lt;strong&gt;Artifact Type &lt;/strong&gt;select &lt;strong&gt;Server&lt;/strong&gt; unless you want to copy the package to a shared folder.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-publish-settings_2.png"&gt;&lt;img title="build-publish-settings" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="build-publish-settings" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/build-publish-settings_thumb.png" height="307" border="0" width="814" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now it&amp;rsquo;s time to save if you haven&amp;rsquo;t yet and run the build.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Release&lt;/h1&gt;
&lt;p&gt;Open the Release tab. As I&amp;rsquo;m writing this blog the Release is in public preview.&lt;/p&gt;
&lt;p&gt;Click on the &lt;strong&gt;Plus &lt;/strong&gt;button and select &lt;strong&gt;Azure Website Deployment&lt;/strong&gt;. It will add a new environment with &lt;strong&gt;Azure Deployment &lt;/strong&gt;and &lt;strong&gt;Visual Studio Test&lt;/strong&gt; tasks for that environment.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-website_2.png"&gt;&lt;img title="release-website" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-website" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-website_thumb.png" height="484" border="0" width="381" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Delete the &lt;strong&gt;Visual Studio Test &lt;/strong&gt;because we&amp;rsquo;re not going to configure it &amp;ndash; I will post another article about configuring Unit Testing.&lt;/p&gt;
&lt;p&gt;You can rename the environment if you want to. Usually you&amp;rsquo;ll create a few environments, like Dev, Testing, Staging, etc.&lt;/p&gt;
&lt;p&gt;Click on the &lt;strong&gt;Artifacts&lt;/strong&gt; tab then click on the &lt;strong&gt;Link an artifact source.&lt;/strong&gt; Select the build you want to link to. There is nothing to add on the &lt;strong&gt;Configuration &lt;/strong&gt;tab so click on the &lt;strong&gt;Triggers &lt;/strong&gt;tab. Check the &lt;strong&gt;Continuous deployment &lt;/strong&gt;and select the artifact and the environment. In the &lt;strong&gt;General &lt;/strong&gt;tab I will change the default name format to &lt;em&gt;Office Inventory - 1.0.0.$(rev:r)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-artifact_2.png"&gt;&lt;img title="release-artifact" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-artifact" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-artifact_thumb.png" height="353" border="0" width="644" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In order to deploy to Azure you need to configure the Azure subscription first. Click on the &lt;strong&gt;Manage&lt;/strong&gt; link on &lt;strong&gt;Azure Subscription&lt;/strong&gt; of the &lt;strong&gt;Azure Web App Deployment &lt;/strong&gt;task. This will open a new page. On that page click on the &lt;strong&gt;New Service Endpoint&lt;/strong&gt; and Select &lt;strong&gt;Azure&lt;/strong&gt; from the list. This will open a modal windows where you need to enter Azure details. The easiest way to get that information is hovering you mouse on the exclamation icon and click on the &lt;strong&gt;publish settings file &lt;/strong&gt;link. That will download the Azure publish settings file. That file is an XML file so open it in your favourite editor. I prefer to use &lt;strong&gt;Certificate Based&lt;/strong&gt; instead the &lt;strong&gt;Credentials&lt;/strong&gt; type because I don&amp;rsquo;t want people to enter their credentials. In any case, extract the information you need from the &lt;strong&gt;publish settings&lt;/strong&gt; file, like &lt;strong&gt;Subscription Id, Name&lt;/strong&gt;, etc. and click OK.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-add-azure-connection_2.png"&gt;&lt;img title="release-add-azure-connection" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-add-azure-connection" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-add-azure-connection_thumb.png" height="377" border="0" width="644" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s go back to the &lt;strong&gt;Environments&lt;/strong&gt; page and click on the Refresh button on the right hand side of the &lt;strong&gt;Azure Subscription.&lt;/strong&gt; Enter the name of your &lt;strong&gt;Azure Web App&lt;/strong&gt;, select the location and the slot (Production or Staging). Click on the Ellipses button select the package.&lt;/p&gt;
&lt;p&gt;Now we&amp;rsquo;re ready to deploy. Save the release and click on the &lt;strong&gt;Release&lt;/strong&gt; button and next &lt;strong&gt;Create Release.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-webapp_5.png"&gt;&lt;img title="release-webapp" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-webapp" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-webapp_thumb_1.png" height="281" border="0" width="804" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;NOTE: You can rename the Tasks if you click the pencil on the right hand side of the task Title.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-rename-task_2.png"&gt;&lt;img title="release-rename-task" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="release-rename-task" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/8f26ee4939c1_6DEB/release-rename-task_thumb.png" height="66" border="0" width="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now you can add multiple environments and continuously deploy to them.&lt;/p&gt;</description><pubDate>Thu, 25 Feb 2016 14:02:31 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/continuous-integration-and-deployment-of-azure-web-app-using-vsts-vso</guid></item><item><title>Using Ninject with ASP.NET Web Api 2</title><link>http://www.ralbu.com:80/using-ninject-with-asp-net-web-api-2</link><description>&lt;p&gt;Dependency Injection in Web Api 2 has changed. For this purpose the NuGet packages for Ninject has been updated adding some breaking changes. If you have used Ninject before and tried the same approach to Web Api 2 or you're updating your Web Api project then it might not work.&lt;/p&gt;
&lt;p&gt;Adding the Ninject package is really simple but you need to know which packages to add.&lt;/p&gt;
&lt;p&gt;The following packages should be added in the specified order. Open the NuGet Package Manager Console and add the following:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;install-package Ninject.Web.WebApi
install-package Ninject.Web.WebApi.WebHost&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Both libraries at the time of writing are 3.2.4.&lt;/p&gt;
&lt;p&gt;You can install &lt;em&gt;Ninject.Web.WebApi.WebHost &lt;/em&gt;only and it will install the &lt;em&gt;Ninject.Web.WebApi &lt;/em&gt;as well. But in my case it installs &lt;em&gt;Ninject.Web.WebApi.WebHost &lt;/em&gt;3.2.4 but &lt;em&gt;Ninject.Web.WebApi &lt;/em&gt;will be 3.2.0.0 because that's the minimum version &lt;em&gt;Ninject.Web.WebApi.WebHost &lt;/em&gt;depends on. And this throws an HttpConfiguration activation error.&lt;/p&gt;
&lt;p&gt;If you follow the two-step process described&amp;nbsp; above it will work.&lt;/p&gt;
&lt;p&gt;The file &lt;em&gt;NinjectWebCommon &lt;/em&gt;will be added to the &lt;em&gt;App_Start &lt;/em&gt;folder. You need to the &lt;em&gt;RegisterServices&lt;/em&gt; method and add your binding, like this&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;kernel.Bind&amp;lt;IUserRepository&amp;gt;().To&amp;lt;UserRepository&amp;gt;();&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I've created a sample project you can checkout &lt;a href="https://github.com/ralbu/ninjectwithwebapi2"&gt;https://github.com/ralbu/ninjectwithwebapi2&lt;/a&gt;&lt;/p&gt;</description><pubDate>Fri, 29 May 2015 16:00:00 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/using-ninject-with-asp-net-web-api-2</guid></item></channel></rss>