<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Tools</title><link>http://www.ralbu.com:80/tags/tools</link><description>Tools</description><item><title>Become a Git command line guru</title><link>http://www.ralbu.com:80/become-a-git-command-line-guru</link><description>&lt;p&gt;Git became one of the widely used Source Control System. If you work on a Windows machine you may rely on your IDE or other tools like &lt;a href="https://desktop.github.com" target="_blank"&gt;GitHub Desktop&lt;/a&gt; or &lt;a href="https://www.sourcetreeapp.com" target="_blank"&gt;Atlassian's SourceTree&lt;/a&gt; to work with git. But in order to get all the power git offers you need to start using git from the command line. Don't get put off by the fact that git on windows is limited. With the right tools and configurations you'll enjoy it and finally you'll start liking it.&lt;br /&gt;The default command line solution for git is to use Git Bash but we'll use &lt;a href="https://conemu.github.io/" target="_blank"&gt;ConEmu&lt;/a&gt; with &lt;a href="https://github.com/dahlbyk/posh-git" target="_blank"&gt;PowerShell Posh Git&lt;/a&gt; module. You'll be very pleased how it works.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Installation&lt;/h1&gt;
&lt;h2&gt;Git&lt;/h2&gt;
&lt;p&gt;If you have not installed git yet let&amp;rsquo;s do it now. Either download it from &lt;a href="https://git-scm.com/download"&gt;https://git-scm.com/download&lt;/a&gt; or run chocolately:&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;choco install git.install&lt;/pre&gt;
&lt;p&gt;You can add &amp;ndash;&lt;em&gt;notSilent &lt;/em&gt;in the command line in order to have the installation wizard if you want to provide different options.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;ConEmu&lt;/h2&gt;
&lt;p&gt;Install ConEmu from &lt;a href="https://github.com/Maximus5/ConEmu"&gt;https://github.com/Maximus5/ConEmu&lt;/a&gt; or run chocolately:&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;choco install conemu&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Posh Git&lt;/h2&gt;
&lt;p&gt;After ConEmu was installed we need to install Posh Git&lt;/p&gt;
&lt;p&gt;Run&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;choco install poshgit&lt;/pre&gt;
&lt;p&gt;Or go to the web site &lt;a href="https://github.com/dahlbyk/posh-git"&gt;https://github.com/dahlbyk/posh-git&lt;/a&gt; and follow the instructions&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When you install poshgit make sure that you have git installed already and the Environment path for git was set before opening the PowerShell. If for some reasons you don't want to have git path in the Environment variable then add the following to your &lt;em&gt;c:\Users\[UserName]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1&lt;/em&gt; file.&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;$env:path += ";" + (Get-Item "Env:ProgramFiles(x86)").Value + "\Git\bin"&lt;/pre&gt;
&lt;p&gt;Replace &lt;em&gt;ProgramFiles(x86)&lt;/em&gt; with &lt;em&gt;ProgramFiles &lt;/em&gt;if you have installed git in &lt;em&gt;Program Files.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The installation of posh-git will add the following in the Microsoft.PowerShell_profile.ps1&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;# Load posh-git example profile
. 'C:\tools\poshgit\dahlbyk-posh-git-869d4c5\profile.example.ps1'&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;ConEmu Configuration&lt;/h1&gt;
&lt;p&gt;Open ConEmu and navigate to a git repository. In my case, I've opened xunit. As you can see from the image the command line has this information: I am on the master branch, 1 file added and two edited.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/Become-a-Git-command-line-guru_AE57/git-cmd_2.png"&gt;&lt;img title="git-cmd" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="git-cmd" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/Become-a-Git-command-line-guru_AE57/git-cmd_thumb.png" border="0" height="55" width="640" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We can add task bar jump list in ConEmu. In this case when I right click on the ConEmu in the task bar it will open a PowerSell console with poshgit at that location.&lt;/p&gt;
&lt;p&gt;Click on the icon on the left hand side of the ConEmu and select &lt;strong&gt;Settings&amp;hellip;&lt;/strong&gt; and then &lt;strong&gt;Startup &amp;gt; Tasks&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/Become-a-Git-command-line-guru_AE57/conemu-menu_2.png"&gt;&lt;img title="conemu-menu" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="conemu-menu" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/Become-a-Git-command-line-guru_AE57/conemu-menu_thumb.png" border="0" height="484" width="183" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By default every item has &lt;strong&gt;Taskbar jump lists &lt;/strong&gt;checked. This means that all the items from the list will appear in Task bar list. We don't need to have all of them, so go though everyone and deselect what you don't need.&lt;/p&gt;
&lt;p&gt;The list in the &lt;strong&gt;Predefined&lt;/strong&gt; tasks contains all tabs you can open when creating a new Console. Let&amp;rsquo;s create one which will open PowerShell with poshgit in C:\Projects:&lt;/p&gt;
&lt;p&gt;Click the + button and add the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Name &amp;ndash; let&amp;rsquo;s name it &lt;strong&gt;Projects.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Task parameters - a path where you want the console to open, for example: &lt;em&gt;/dir "c:\Projects&lt;/em&gt;"&lt;/li&gt;
&lt;li&gt;Start console: &lt;em&gt;powershell.exe&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Click Up to move it to a desired location.&lt;/p&gt;
&lt;p&gt;Click Save settings with Shift key pressed because we don&amp;rsquo;t want to close the dialog yet.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.ralbu.com/Media/Default/Windows-Live-Writer/Become-a-Git-command-line-guru_AE57/task-configuration_2.png"&gt;&lt;img title="task-configuration" style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border: 0px;" alt="task-configuration" src="http://www.ralbu.com/Media/Default/Windows-Live-Writer/Become-a-Git-command-line-guru_AE57/task-configuration_thumb.png" border="0" height="439" width="644" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the next step we'll add our new created Task to the Task bar jump list. Go to the &lt;em&gt;Main &amp;gt; Task&lt;/em&gt; bar. At the bottom of the window check &lt;strong&gt;Add ConEmu tasks &lt;/strong&gt;and click &lt;strong&gt;Update Now!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Click Save settings and we're done with the ConEmu settings. Now when you right click on Task bar you can open a new ConEmu instance directly into you Git local repository.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Git colours&lt;/h1&gt;
&lt;p&gt;Let's set a few colours in Git. If you use PowerShell colour scheme in ConEmu (I prefer ConEmu scheme) then the text in the default red colour will be difficult to read on the blue background. You fix this by adding the following in the &lt;em&gt;Microsoft.PowerShell_profile.ps1&lt;/em&gt; file.&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;$global:GitPromptSettings.WorkingForegroundColor&amp;nbsp;&amp;nbsp;&amp;nbsp; = [ConsoleColor]::DarkGray&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;At this point all the PowerShell configuration is done. But I don't like the default git colours so I will update a few colours for git. This is nothing to do with PowerShell and this changes will apply to Git Bash as well.&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;git config --global color.status.added "green normal bold"
git config --global color.status.header "cyan normal bold"
git config --global color.status.updated "green normal bold"
git config --global color.status.changed "cyan"
git config --global color.branch.remote "blue normal bold"
git config --global color.branch.current "green normal bold"
git config --global color.branch.local "green dim"&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;git configuration&lt;/h1&gt;
&lt;h2&gt;Store git credentials&lt;/h2&gt;
&lt;p&gt;An easy way to store git credentials so you don&amp;rsquo;t have to type them every time is to use &lt;strong&gt;Git Credential Manager for Windows&lt;/strong&gt;, download it from &lt;a href="https://github.com/Microsoft/Git-Credential-Manager-for-Windows"&gt;https://github.com/Microsoft/Git-Credential-Manager-for-Windows&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Compare configuration&lt;/h2&gt;
&lt;p&gt;Before committing my files I like to compare my local changes with the remote version. I do that using &lt;a href="http://www.scootersoftware.com/" target="_blank"&gt;Beyond Compare&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I run the comparison from the command line:&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;git difftool&lt;/pre&gt;
&lt;p&gt;And configure git to use Beyond Compare:&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;git config --global merge.tool bc
git config --global mergetool.bc.path "c:/Program Files/Beyond Compare 4/bcomp.exe"
git config --global difftool.prompt false
&lt;/pre&gt;
&lt;p&gt;And the last step, I don&amp;rsquo;t want to write &lt;em&gt;difftool&lt;/em&gt; every time so let&amp;rsquo;s create an alias:&lt;/p&gt;
&lt;pre class="brush: bash;"&gt;git config --global alias.dt difftool&lt;/pre&gt;
&lt;p&gt;Now it is just enough to type &lt;em&gt;dt&lt;/em&gt; and it will run the comparer.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;As you can see there&amp;rsquo;s enough work to do in order to have a proper git command line on Windows. But you don&amp;rsquo;t have to configure everything. The most important thing is ConEmu and poshgit.&lt;/p&gt;</description><pubDate>Tue, 26 Jul 2016 05:02:37 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/become-a-git-command-line-guru</guid></item><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>PowerShell with Visual Studio</title><link>http://www.ralbu.com:80/powershell-with-visual-studio</link><description>&lt;p&gt;I started doing more and more PowerShell recently to automate provisioning environments on Azure and for CI &amp;amp; CD. I use Sublime for my editing - it's the best editor I've used but what I miss is a good vim plugin - or perhaps I haven't found that one. I use &lt;a href="https://visualstudiogallery.msdn.microsoft.com/59ca71b3-a4a3-46ca-8fe1-0e90e3f79329" target="_blank"&gt;vim editor&lt;/a&gt; with my Visual Studio 2013.&lt;/p&gt;
&lt;p&gt;Visual Studio might sound like not the tool for writing PowerShell scripts but with the right plugin will make your life easier.&lt;/p&gt;
&lt;p&gt;Here you install Visual Studio plugin: &lt;a href="https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597" target="_blank"&gt;https://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597&lt;/a&gt;. You get the intellisense support, debugging and even Unit Testing integration with &lt;a href="https://github.com/pester/Pester" target="_blank"&gt;Pester&lt;/a&gt;. In order to do this you need to use a PowerShell project. Usually I only need to edit my PowerShell scripts and I like to have the list of folders and files like you have with Visual Studio project or solution. There isn't a way in Visual Studio to open just a folder as you have in Sublime. The closest way of doing that is open File &amp;gt; Open &amp;gt; Web Site&amp;hellip; Select File System and select the folder you want to open.&lt;/p&gt;
&lt;p&gt;If you're developer and Visual Studio is your main IDE then this will be a nice addition to your Visual Studio tool set.&lt;/p&gt;</description><pubDate>Sat, 20 Jun 2015 05:02:26 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/powershell-with-visual-studio</guid></item><item><title>Displaying AppVeyor build status badge in a repository</title><link>http://www.ralbu.com:80/displaying-appveyor-build-status-badge-in-a-repository</link><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you're using &lt;a href="https://ci.appveyor.com"&gt;AppVeyor&lt;/a&gt; for your CI then you can display the build status in your repository readme page. You do that by using the Status Badge. There&amp;rsquo;s is good documentation on their web site &lt;a href="http://www.appveyor.com/docs/status-badges"&gt;http://www.appveyor.com/docs/status-badges&lt;/a&gt;. But if you're doing this for the first time then you might get confused as to which option to choose and where to get the data you need.&lt;/p&gt;
&lt;p&gt;If you don't want to read an entire blog about badges then head to your AppVeyor project page, click on the &lt;em&gt;&lt;strong&gt;settings&lt;/strong&gt;&lt;/em&gt; link and then click on the &lt;strong&gt;&lt;em&gt;Badges&lt;/em&gt;&lt;/strong&gt; link. Search for &lt;em&gt;Sample markdown code, &lt;/em&gt;copy that code and put it in your repository page. You're done.&lt;/p&gt;
&lt;p&gt;If you're still reading then you want to know more details, so choose the option that suits you better. The examples I will provide are from my &lt;a href="https://github.com/ralbu/randomuser"&gt;randomuser&lt;/a&gt; GitHub repository.&lt;/p&gt;
&lt;h1&gt;Public repositories from GitHub or Bitbucket&lt;/h1&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If your source code repository is public then you have two options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use the URL as described above from your project settings&lt;/li&gt;
&lt;li&gt;Use the URL from your public repository. In this case you need to have only one AppVeyor project.&lt;br /&gt;The URL has the following format:&lt;br /&gt;&lt;code&gt;https://ci.appveyor.com/api/projects/status/{github|bitbucket}/{repository}&lt;/code&gt; For example:&lt;br /&gt;&lt;code&gt;https://ci.appveyor.com/api/projects/status/github/ralbu/randomuser&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I would prefer the second choice for public repositories. In the first case you need to embed your AppVeyor project id into the url. I'm not sure about the security implications in this case, if let's say you want to make the AppVeyor project private. In this case you don't want to expose that id.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Status Badge options&lt;/h1&gt;
&lt;p&gt;You have three options when displaying a badge:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A simple badge. Use the URL with no query string parameters &lt;br /&gt;&lt;code&gt;https://ci.appveyor.com/api/projects/status/github/ralbu/randomuser&lt;/code&gt; &lt;br /&gt;&lt;img alt="" src="/Media/Default/Windows-Live-Writer/Displaying-AppVeyor-build-status-badge-o_99C0/av13_2.png" height="18" width="100" /&gt; &lt;br /&gt;Retina badge. Add &lt;em&gt;retina=true&lt;/em&gt; parameter &lt;br /&gt;&lt;code&gt;https://ci.appveyor.com/api/projects/status/github/ralbu/randomuser?retina=true&lt;/code&gt; &lt;br /&gt;&lt;img alt="" src="/Media/Default/Windows-Live-Writer/Displaying-AppVeyor-build-status-badge-o_99C0/av%20retina_2.png" height="36" width="200" /&gt; &lt;br /&gt;This parameter will scale the image but the image doesn't look very sharp.&lt;/li&gt;
&lt;li&gt;SVG badge. Add &lt;em&gt;svg=true&lt;/em&gt; parameter &lt;br /&gt;&lt;code&gt;https://ci.appveyor.com/api/projects/status/github/ralbu/randomuser?svg=true&lt;/code&gt;&amp;nbsp;&lt;br /&gt;&lt;a href="http://localhost:400/Media/Default/Windows-Live-Writer/Displaying-AppVeyor-build-status-badge-o_99C0/apsvg.png"&gt;&lt;/a&gt;&lt;img alt="" src="/Media/Default/Windows-Live-Writer/Displaying-AppVeyor-build-status-badge-o_99C0/apsvg.png" height="36" width="176" /&gt; &lt;br /&gt;I like this badge and I use it instead of the first two.&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;&amp;nbsp;&lt;/h1&gt;
&lt;h1&gt;Building state of the status badge&lt;/h1&gt;
&lt;p&gt;There is a difference in the status displayed on the badge when the project is queued or in building process on the SVG image compared with other two images.&lt;br /&gt;The SVG badge says 'pending' and the other two say 'building...'&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Display the status badge in the Markdown format&lt;/h1&gt;
&lt;p&gt;&lt;br /&gt;When using the Markdown format you &lt;span style="background-color: #ffff00;"&gt;&lt;/span&gt;display the badge status using the following format &lt;br /&gt;&lt;code&gt;[![Alt img description](Badge Url as described above)](The url to your AppVeyor status page.)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;[![Build status](https://ci.appveyor.com/api/projects/status/github/ralbu/randomuser?svg=true)](https://ci.appveyor.com/api/projects/status/github/ralbu/&lt;/code&gt;&lt;/p&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;&lt;br /&gt;You have other options to choose from, like displaying the status of a branch. More information can be found on &lt;a href="http://www.appveyor.com/docs/status-badgesing"&gt;http://www.appveyor.com/docs/status-badgesing&lt;/a&gt;&lt;/p&gt;</description><pubDate>Wed, 29 Apr 2015 21:21:00 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/displaying-appveyor-build-status-badge-in-a-repository</guid></item><item><title>Running xUnit.net tests using ReSharper</title><link>http://www.ralbu.com:80/running-xunit-net-tests-using-resharper</link><description>&lt;p&gt;If you have created new projects in Visual Studio recently and you use xUnit.net with ReSharper to run your tests you might find that your tests are not running. The reason for that is that xUnit.net has been updated to version 2. Also xUnit.net runner for Visual Studio is no longer needed.&lt;/p&gt;
&lt;p&gt;Follow this steps to run the new xUnit.net 2.0&lt;/p&gt;
&lt;p&gt;1. Install xUnit.net with the NuGet command&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;install-package xunit&lt;/pre&gt;
&lt;p&gt;If you check the packages.config file you&amp;rsquo;ll see that there are a few more packages added apart from xunit. One of this is the assertion library. The core framework is separated from the assertion library.&lt;/p&gt;
&lt;p&gt;2. Install xUnit Visual Studio runner&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;install-package xunit.runner.visualstudio&lt;/pre&gt;
&lt;p&gt;If you don&amp;rsquo;t use ReSharper to run unit tests this should be enough otherwise follow the next step.&lt;/p&gt;
&lt;p&gt;3. Click the &lt;em&gt;Resharper&amp;gt;Extension Manager&amp;hellip;&lt;/em&gt; Find the &lt;em&gt;xUnit.net Test Support for ReSharper 9 &lt;/em&gt;(it should be the same for 8) and click the Update button.&lt;/p&gt;</description><pubDate>Fri, 20 Mar 2015 22:23:00 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/running-xunit-net-tests-using-resharper</guid></item><item><title>Git versioning for .NET projects with TeamCity</title><link>http://www.ralbu.com:80/post/2013/03/28/Git-versioning-for-NET-projects-with-TeamCity</link><description>&lt;p&gt;TeamCity has a nice feature which allows to create a build number automatically with every build. For example, MyLib.dll has version 1.2.3.0. When configuring TeamCity in the &amp;ldquo;Build number format&amp;rdquo; the value specified like {0} will increase with every build. So if you set &amp;ldquo;Build number format&amp;rdquo; 1.2.3.{0} then the last number (revision number) will increase with every build.&lt;/p&gt;
&lt;p&gt;For a .NET project if you provide the AssemblyInfo patcher feature for your build configuration then the AssemblyVersion and AssemblyFileVersion will be updated automatically with the build number.&lt;/p&gt;
&lt;p&gt;This works well for the cases when only one number should be changed. But you might want to have two numbers updated with your build, build and revision values. With Subversion you can include the repository Revision number as part of the building number. Git doesn&amp;rsquo;t provide this number because each commit is represented by a SHA1 hash.&lt;/p&gt;
&lt;p&gt;The solution will be to take advantage of the number of commits since the most recent tag. This is made available through the &lt;a href="https://www.kernel.org/pub/software/scm/git/docs/git-describe.html"&gt;git describe&lt;/a&gt; command.&lt;/p&gt;
&lt;p&gt;This will work only if you have at least one tag in your repository and every time you need to change you version you need to create a new tag. Also you need to push your tag to the remote repository as it is not pushed automatically.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s add a new tag to your commit&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;git tag v1.2&lt;/pre&gt;
&lt;p&gt;And use describe command&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;git describe --tags --long&lt;/pre&gt;
&lt;p&gt;Will display&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;v1.2-0-gb2d5397&lt;/pre&gt;
&lt;p&gt;The --tags flag allows to use lightweight tag and --long takes care to display the long format &amp;ndash; the tag, the number of commits and the abbreviated commit name.&lt;/p&gt;
&lt;p&gt;The 0 number represent the number of commits.&lt;/p&gt;
&lt;p&gt;The describe command works fine but what happens if a new tag is created and its purpose is not for versioning. To fix this will add the --match flag so your command will become:&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;git describe --tags &amp;ndash;long --match v?.?&lt;/pre&gt;
&lt;p&gt;This will display only the tags which are in format v?.?, v1.2 for instance. If you want to keep your versioning tags differently, for example version1.2 then you need to change v?.? to version?.?&lt;/p&gt;
&lt;p&gt;That is all good but how can we use it with TeamCity? We will create a Powershell script which parses the output and creates the build number.&lt;/p&gt;
&lt;p&gt;In TeamCity &amp;ldquo;Runner type&amp;rdquo; is set as Powershell and in the &amp;ldquo;Script arguments&amp;rdquo; %build.number% is provided.&lt;/p&gt;
&lt;p&gt;Will use the following script&lt;/p&gt;
&lt;pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;Param ([string]$build_num)

$git_version = (git describe --tags --long --match v?.? | Select-String -pattern '(?&amp;lt;major&amp;gt;[0-9]+)\.(?&amp;lt;minor&amp;gt;[0-9]+)-(?&amp;lt;seq&amp;gt;[0-9]+)-(?&amp;lt;hash&amp;gt;[a-z0-9]+)').Matches[0].Groups

$git_describe = $git_version[0].Value

$version = [string]::Join('.', @(
  $git_version['major'],
  $git_version['minor'],
  $git_version['seq'],
  $build_num 
))

Write-Host "##teamcity[buildNumber '$version']"&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Line 1: reads the provided %build.number% from TeamCity&lt;/li&gt;
&lt;li&gt;Line 3: uses the git describe command and creates an object with all version parts&lt;/li&gt;
&lt;li&gt;Lines 7-12: create a version string based on the git tag and TeamCity&lt;/li&gt;
&lt;li&gt;Line 14: uses TeamCity service messages to pass the information to TeamCity&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This step should be added before the step where you compile your project.&lt;/p&gt;</description><pubDate>Thu, 28 Mar 2013 05:26:00 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/post/2013/03/28/Git-versioning-for-NET-projects-with-TeamCity</guid></item><item><title>Unbind TFS</title><link>http://www.ralbu.com:80/post/2013/03/20/Unbind-TFS</link><description>&lt;p&gt;This a follow up post to the previous one &lt;a href="http://ralbu.com/post/2013/02/16/Migration-from-TFS-to-Git.aspx"&gt;Migration from TFS to Git&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you migrated your code from TFS to Git you'll soon realise that you don't need all the TFS bindings. After spending some time trying to find a tool which does this I've wrote mine. The tools I found didn't do what I need. They remove the bindings ok but in case with git you get the '.git' folder and the tools remove bindings in this folder as well.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I put the source code on GitHub so you can download it and use at your own risk. It edits the .sln, .csproj and deletes .vsssscc and vspscc files. Find the details on the GitHub web site: &lt;a href="https://github.com/ralbu/UnbindTFS"&gt;Unbind TFS&lt;/a&gt;&lt;/p&gt;</description><pubDate>Wed, 20 Mar 2013 15:35:00 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/post/2013/03/20/Unbind-TFS</guid></item><item><title>Migration from TFS to Git</title><link>http://www.ralbu.com:80/post/2013/02/16/Migration-from-TFS-to-Git</link><description>&lt;p&gt;Some time ago we were trying to migrate our code from TFS 2008 to the hosted TFS (http://tfs.visualstudio.com) using TFS Integration tool - &lt;a title="http://tfsintegration.codeplex.com/" href="http://tfsintegration.codeplex.com/"&gt;http://tfsintegration.codeplex.com/&lt;/a&gt;. After a few failed attempts we decided not to migrate the history but only the latest version of code and keep the TFS 2008 for historical reference. Although the tool wasn&amp;rsquo;t properly tested with hosted TFS it worked in some cases. I managed to migrate a few folders but not the entire project. Our project has a complex tree structure and keeps the history since 2008. Also some of the branches were deleted during the time. Because of all of this the migration was a nightmare.&lt;/p&gt;
&lt;p&gt;The migration was postponed due to other tasks and the good things happen during this time &amp;ndash; Microsoft announced Git support in TFS, in hosted TFS as well. Hosted TFS had Git implemented for some time already but the option wasn&amp;rsquo;t enabled except for a few people including MVPs.&lt;/p&gt;
&lt;p&gt;If you need to get your TFS source into Git first of all you need to get it from TFS into your local Git. For this purpose you&amp;rsquo;ll need either git-tfs or git-tf. After installing one of this, clone your TFS:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;git tfs clone &lt;a href="http://[YourTFSserver]:8080/tfs/DefaultCollection"&gt;http://[YourTFSserver]:8080/tfs/DefaultCollection&lt;/a&gt; $[FolderOrProjectName]&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Here we run into troubles as we were given the following error:&lt;/p&gt;
&lt;p&gt;TF50605: There was an error looking up the SID for [SOME USER NAME]&lt;/p&gt;
&lt;p&gt;The error was related to a domain user who left the company some time ago. Using the help from this web site: &lt;a title="http://davehope.co.uk/Blog/deleting-the-tfs-workspace-for-a-missing-account-fails-tf50605/" href="http://davehope.co.uk/Blog/deleting-the-tfs-workspace-for-a-missing-account-fails-tf50605/"&gt;http://davehope.co.uk/Blog/deleting-the-tfs-workspace-for-a-missing-account-fails-tf50605/&lt;/a&gt; we managed to delete the workspace linked to this user but it didn&amp;rsquo;t fix the issue.&lt;/p&gt;
&lt;p&gt;When you clone the TFS project the command line will display the changeset it&amp;rsquo;s cloning, something like:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;C1250&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Which means the changeset 1250. We searched this changeset using Team Explorer in VS and we found out that the changeset is assigned to the same user with the workspace issue.&lt;/p&gt;
&lt;p&gt;The only way to reassign this changeset to a different user is to update your TFS database.&lt;/p&gt;
&lt;p&gt;Run this to find the owner if:&lt;/p&gt;
&lt;pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;SELECT IdentityId FROM tbl_Identity WHERE (DisplayName LIKE 'USER NAME')&lt;/pre&gt;
&lt;p&gt;Now when you have the IdentityId you can find all the changesets made by this user:&lt;/p&gt;
&lt;pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;SELECT * FROM tbl_ChangeSet WHERE ownerid = [OWNERID]&lt;/pre&gt;
&lt;p&gt;A simple update will reasign the changesets to another user:&lt;/p&gt;
&lt;pre class="brush: sql; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;"&gt;UPDATE tbl_ChangeSet 
SET ownerid =  [IDENTITYID OF ANOTHER USER], committerid=[IDENTITY ID OF ANOTHER USER] 
WHERE ownerid = [IDENTITY ID OF THE OLD USER]&lt;/pre&gt;
&lt;p&gt;After this update we clone the project again and after about 8 hours the project was cloned into local Git.&lt;/p&gt;
&lt;p&gt;The next step is to push the source to the Git repository. Some steps, like removing TFS binding before pushing should be done. This article explain everything you need to now: &lt;a title="http://devlicio.us/blogs/derik_whittaker/archive/2012/11/07/moving-from-tfs-to-github-what-we-did.aspx" href="http://devlicio.us/blogs/derik_whittaker/archive/2012/11/07/moving-from-tfs-to-github-what-we-did.aspx"&gt;http://devlicio.us/blogs/derik_whittaker/archive/2012/11/07/moving-from-tfs-to-github-what-we-did.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you want to use git from Visual Studio you&amp;rsquo;ll need to install the CTP for Visual Studio Update 2: &lt;a title="http://blogs.msdn.com/b/visualstudioalm/archive/2013/02/11/february-ctp-for-visual-studio-update-2.aspx" href="http://blogs.msdn.com/b/visualstudioalm/archive/2013/02/11/february-ctp-for-visual-studio-update-2.aspx"&gt;http://blogs.msdn.com/b/visualstudioalm/archive/2013/02/11/february-ctp-for-visual-studio-update-2.aspx&lt;/a&gt; and Visual Studio Tools for Git: &lt;a title="http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c" href="http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c"&gt;http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c&lt;/a&gt;&lt;/p&gt;</description><pubDate>Sat, 16 Feb 2013 15:35:00 GMT</pubDate><guid isPermaLink="true">http://www.ralbu.com:80/post/2013/02/16/Migration-from-TFS-to-Git</guid></item></channel></rss>