10 April, 2016

Using VSTS from SourceTree on a Mac

Using Visual Studio Team Services is a great joy. It is a seamless experience when on Windows, but does require one extra step when using it from a Mac. As is the case when using VSTS from XCode (see http://blog.clauskonrad.net/2016/03/using-visual-studio-team-services-git.html) you also here need to establish an alternative representation of yourself that can work as authentication.

Here is how to use the SourceTree application on a Mac against VSTS:

  1. Log into VSTS (website)
  2. Select your name (top right)
  3. Select My Profile
  4. Select Security
  5. Select Add
    image
  6. Copy the generated Token (it will show only once) into a text file on disk
  7. Open SourceTree
  8. Press Repositories
  9. Select Clone from Url
  10. Enter the SourceControl Endpoint (https://<nameofcollection>.visualstudio.com)
  11. When prompted for Username/password – enter the Token instead of your username
  12. Enter your normal password
  13. You are in!

Screen Shot 2016-04-08 at 10.27.01 

Screen Shot 2016-04-08 at 10.23.49

16 March, 2016

Using Visual Studio Team Services (GIT) on Windows and Mac at the same time?

Why use Visual Studio Team Services?


Microsoft’s Azure backed (and thus hosted) source control system Visual Studio Team Services really is a great toolset to work with. As they have made it as easy as they have to work with; I find it extremely difficult to argue why you would want to host your own source control system anymore?
 image

I agree that back in the day that was how you did it; but honestly few developers get paid for managing a source control system per se. They are paid to deliver the product the source control system holds, which is the software product they are building. If you are dealing with defence related software one might argue that due to IP rights and the nature of the product; it might make sense but for the rest of us mere mortals, it is just an unnecessary hassle to manage this piece of infrastructure. Therefore – it is with the greatest conviction I’m proposing and using myself the hosted source control system in Azure both in a private setting as well as a business related setting.

GIT on TFS?

Github has become extremely popular the recent years. Initially I found it difficult to understand and appreciate that popularity as I came with 10 years of experience with the original Team Foundation Server myself; but is it not always like that when you do not understand something foreign to you? Having gotten my head around this source control system known as GIT I with a full heart honestly can understand and appreciate the nature of this system.

Using VSTS (GIT) on Windows and Mac at the same time?


As I’m not only doing Windows development these days, I have a need for hosting my source code somewhere common. I do not want to setup two different systems just because I happen to be developing in two worlds (.NET and Apple). After all source code is ultimately just a set of text-files (strictly speaking).From a Windows machine (i.e. Visual Studio 2013/2015) it’s a walk in the park to authenticate with VSTS as this to no surprise supports Microsoft accounts natively.

image

Unfortunately, this is not the case when attempting to authenticate from Apple’s XCode IDE. They do not support the usage of ‘name@domain.com’ for some bizarre reason. You need to generate a person token that ‘imitate’ your username. How you do this is the topic of the below paragraph and I hope it can serve you as a guide so you do not need to figure this out yourself the hard way as I did.

Setting up GIT/VSTS access from XCode


    First you need to create a personal token for your username to work as stand in for you in XCode:
  1. Login to the website of your source control system (<name>.visualstudio.net)Screen Shot 2016-03-16 at 23.22.38
  2. When in the website – navigate to the section called My Profile –> SecurityScreen Shot 2016-03-16 at 23.22.54
  3. Press Add to crete a new tokenScreen Shot 2016-03-16 at 23.23.17
  4. You are done on the server side now. Open XCode on the Mac
  5. Open the Source Control menu item and press CheckOutScreen Shot 2016-03-16 at 23.25.24
  6. When it prompts you for credentials, enter the token instead of your normal username (microsoft account)
  7. Enter your password as you are used to and Next
  8. You are done and can now use Git from X-Code as if you were talking with Github or something else speaking GIT.


That is actually all there is to it. You will be able to find your source code and branches in VSTS online immediately after a push.

Technorati Tags: ,,,

28 January, 2016

TFS online: how to ignore packages (nuget)

If you want to avoid checking in NuGet packages into your source control system; you have to introduce a .tfignore file into the system.

  1. Create a text file: tfignore.txt
  2. Place it next to your solution file
  3. Open the file and add \packages as the only content
  4. Open the folder in a command prompt (cmd)
  5. rename the file by typing: ren tfignore.txt .tfignore
  6. check the file into source control
  7. TFS now no longer regards this folder (\packages) as valid content

10 September, 2015

Essential (developer) tools: A biased list – 2015 version

I did a list of essential developer tools some years back. A lot of water has run under the bridge since then, so I feel it is time for an updated version.

It doesn't look like much and it honestly isn’t, but it is the focused and essential list of tools you need in your toolbox as a .NET developer/troubleshooter.

04 August, 2015

WebAPI 1: How to read [FromBody] parameters

For some reason – the small but important details are oftentimes difficult to recover and you are forced to resort to Googles search engine for a solution.

I have a WebAPI (version 1) method decorated with [FromBody] indicating that the WebAPI framework shall locate the ticketValue in the body of the request instead of from the URI which is the default when presented with simple types (such as string or int or…).

[POST("eticket/{version:int}")]
[
AllowAnonymous]
public void ETicket([FromBody] string ticketValue, int version)
{
//implementation omitted...
}

To my great surprise sending in the below HTTP POST request from Fiddler resulted in ticketValue being null.
The strange syntax in the body (=testValue) could also seem wrong to the first time eye, but as the WebAPI allows for only one body value, this is the syntax. I would have thought you should send in a syntax like: ticketValue=testValue, but this will not work.


image



 What I learned was:
The WebAPI uses the content-type of the incoming request to determine which media-formatter it uses to retrieve the values from the request. So the request needs to have this specified in the Request header as Content-Type: application/x-www-form-urlencoded (see below).
The below works and the WebAPI method (server side) is invoked populated from the Request when called.image

29 April, 2015

Azure TableStorage: Insert results in 400: Bad request

Just a reminder to self. If you run into an exception when inserting entities into a Azure Table; make sure that if you have any properties in your tableentry that are of type datetime, they must have a value > 01.01.1601 (and not the default value which is 01.01.0001).

Takes some time to pin point!

21 March, 2015

Windows 10 – running side by side with Windows 8.1

If you wish to try out Windows 10 (at the time of writing meaning build .10041) on your actual hardware as opposed to some virtual machine you can certainly do so if you utilize the VHD approach. This will allow Windows to run off the actual hardware of your laptop.

WP_20150321_21_29_38_Pro

It is a process that requires some steps though, so grab a cup of coffee and stay awake.

1) First – create a VHD file (Virtual Hard Drive)

image

image

2) Let it run. It will take some time as you have selected fixed size file (or disk if you will). This gives the best performance

3) Rightclick on the newly created disk and select “Initialize Disk”

4) Format the disk as “Simple Volume”

5) (you can double check that you indeed do have a file called C:\VHD\WIN10.vhd)

6) Now – insert your USB key with the Windows 10 ISO image into your laptop

7) Boot the laptop from this USB drive (press F12)

8) Press the Install Now button

image

9) When arriving at this page – select the “Custom: Install Windows only

image

10) Now – be careful here! You do not see your newly created VHD disk onto which you want to install Windows 10. This is the disk you want to see before continuing.

image

Press Shift + F10 and you will gain a command prompt:

image

11) type the following

diskpart [enter]

select vdisk file=c:\vhd\win10.vhd [enter]

attach vdisk [enter]

12) Now return to your drive overview, press Refresh and witness your vhd file (represented as a hard disk)

image

image

13) Select this second hard disk and run the usual installation process

image

image

14) You now have a dual boot system and are good to go

WP_20150321_21_29_38_Pro

 

Technorati Tags: