Setting up a hosted svn server using tortoise svn and collabnet subversion server

Most professional developers use some form of version control at their work but lack such a support system at home.  One of the easiest ways to get up and running is by using TortoiseSVN for Windows.  The best part about it is that it is both intuitive and FREE!  Furthermore, if you have a separate pc that you want to use as a hosted source control server, you can use CollabNet Subversion Server (also a free application).

This tutorial is designed to show how to host a subversion server so it is available to other machines on your network.  For my setup, I am running Windows 7 Ultimate edition x64 on my primary machine.  For my secondary machine (named BuildServer), I am running Windows 7 Ultimate x32 in a hosted VMWare virtual machine.  Both systems already have TortoiseSVN installed.  TortoiseSVN is simply one of the best windows clients for subversion.  You can download it from:

The next step is to go to the machine where you want to host your source control server.  Download the CollabNet Subversion Server for Windows from the following link:

Once downloaded, begin your install process.  The following set of screen shots show what you can expect (as you can see, I am currently using CollabNet Subversion Server 1.6.11).



There are a few options for how you want to host your source control server.  Since I am on a Windows machine that has IIS running, I chose to run CollabNet Subversion Server as a windows service.  The alternative would be to use the included Apache(MOD_DAV_SVN) server.  It has it’s own advantages, but I was not patient enough to get the configuration properly set up side by side with IIS.  I suspect, if I didn’t have IIS on the machine, the Apache install would have been just as easy.


Here I chose the default port for communication but I modified the Repository Path to a shared network drive.  By default, it prompts to put the repository in C:\svn_repository.  I, however, wanted it on a network path so it can properly be backed up in the event that my virtual machine is turned off.


All of the other selections I chose were the defaults.  


Once I initiated the install itself, it also prompted me to enable update notifications. 


It ran the auto-update and then showed this last prompt to finish.


I don’t recall for certain, but I think the system then prompted me to reboot my machine.  Whether prompted or not, I happened to reboot my machine.  You can then verify it installed by opening the command prompt and running “svnadmin –version”.

I recommend running the command line in administrator mode so you can then perform the next step.


After confirming the software installed successfully, you need to create the service in windows.  This can be done through the command prompt using the following command:

sc create binpath=”\C:\Program Files\CollabNet\Subversion Server\svnserve.exe\” –service –root C:\” displayname= “Subversion” depend= tcpip start= auto

NOTE: if this command fails to install or you see a different script response, double check that you are running the command prompt in Administrator mode (applicable to Vista & Windows 7 configurations) and that you have administrator rights on the machine.


Next, go to your system services.  Find “CollabNet Subversion svnserve” and start the service.  A reboot would have been just as effective because the service is set to start automatically.  Alternatively, I could have started the service from command line.


For curiosity, I examined the properties of the service and the path to the executable was listed as follows:

"C:\Program Files\CollabNet\Subversion Server\svnserve.exe" --service -r "\\vmware-host\Shared Folders\S\svn_repository" --listen-port "3690"

Notice the switches specifying the repository path and the listen port.  Depending on how secure you’ve got your machine set, you may need to explicitly open the port the local firewall and/or router.

First, verify that the service is working successfully by opening your TortoiseSVN client and entering “svn://localhost” as your repository url.


Once you have verified you can access the repository locally, try to access it remotely.  Go to your other machine that is on the same network.  Open the TortoiseSVN repository browser and browse  either by using the machine’s name or direct IP address. 


That’s it!  You are now up and running with your very own hosted source control.  I have even verified that after I configured the port pass through on my firewall, I can access my repository server from outside of my home network!  Consider yourself warned though.  Configuring the port pass through is a definitive security risk.  I recommend before setting up your repository for remote access, you consider seeking help from your friendly network administrator….oh wait.  If you are reading this, you probably are your own network admin!  Just be careful and good luck! 

Happy Coding!

Simple Generic Upcast example in using reflection

Here is a quick example of how one can use reflection to perform an upcast in 

In the sample code below, you have  a person class and a contact class.  The contact class inherits from the person class.  Additionally, you have an instance of the Person class which needs to be converted to an instance of the Contact class.  The below code can be used to perform this conversion. 

This may not be the best way to do this, but it is certainly an easy and quick way of performing the task.

  1. Module Module1
  3.     Sub Main()
  4.         Dim p As New Person() With {.First = "Test", .Last = "User"}
  5.         Console.WriteLine("{0} {1} {2}", p.GetType.FullName, p.First, p.Last)
  7.         Dim c As Contact = Upcast(Of Person, Contact)(p)
  8.         c.Phone = "555-123-4567"
  9.         Console.WriteLine("{0} {1} {2} {3}", c.GetType.FullName, c.First, c.Last, c.Phone)
  10.         c.CallContact()
  12.         Console.ReadLine()
  13.     End Sub
  15.     Public Function Upcast(Of B, S As {New, B})(ByVal baseObj As B) As S
  16.         Dim superObj As S = New S()
  17.         Dim superProp As System.Reflection.PropertyInfo = Nothing
  19.         For Each baseProp As System.Reflection.PropertyInfo In baseObj.GetType().GetProperties()
  20.             superProp = superObj.GetType().GetProperty(baseProp.Name)
  21.             superProp.SetValue(superObj, baseProp.GetValue(baseObj, Nothing), Nothing)
  22.         Next
  24.         Return superObj
  25.     End Function
  27.     Public Class Person
  28.         Private _First As String
  29.         Private _Last As String
  31.         Public Property First() As String
  32.             Get
  33.                 Return _First
  34.             End Get
  35.             Set(ByVal value As String)
  36.                 _First = value
  37.             End Set
  38.         End Property
  40.         Public Property Last() As String
  41.             Get
  42.                 Return _Last
  43.             End Get
  44.             Set(ByVal value As String)
  45.                 _Last = value
  46.             End Set
  47.         End Property
  48.     End Class
  50.     Public Class Contact
  51.         Inherits Person
  53.         Private _Phone As String
  54.         Public Property Phone() As String
  55.             Get
  56.                 Return _Phone
  57.             End Get
  58.             Set(ByVal value As String)
  59.                 _Phone = value
  60.             End Set
  61.         End Property
  63.         Public Sub CallContact()
  64.             Console.WriteLine("Calling {0}....", Phone)
  65.         End Sub
  66.     End Class
  67. End Module