Skip to main content

Setting up SVN on Windows

Since I started doing development and there were revisions, I felt the need for a local version control. Heard SVN is good and also setting up is a cake walk. Well, I had my doubts. Setting up a version control server can't be a cake walk!! I was proved wrong.

Setting up SVN:
1. Downloaded SVN from tigris site here and install

Note: Before creating a repository refer the Subversion documentation that comes along with the SVN to know more details about planning your repository organization etc. It has a good write up.

2. I decided to create one repository for each of my software projects. So here it goes...
Issue the following command to create a repository:
> svnadmin create "d:\svn_rep\myproj"
> dir d:\svn_rep\myproj
conf
db
format
hooks
locks
README.txt
This creates a new directory "d:\svn_rep\myproj" which contains the SVN repository.

4. Now setup your project files in a directory as below:

d:\tmp\helloworld\branches\
d:\tmp\helloworld\tags\
d:\tmp\helloworld\trunk\
                                                 MainForm.cs
                                                 MainForm.designer.cs
                                                 Program.cs
                                                 HelloWorld.csproj
                                                 HelloWorld.sln

5. Now that you have your files ready, import it into respository using svn import

> svn import d:\tmp\HelloWorld file:///d:/svn_rep/myproj/HelloWorld -m "initial import"
Adding D:\tmp\HelloWorld\trunk
Adding D:\tmp\HelloWorld\trunk\HelloWorld.sln
Adding D:\tmp\HelloWorld\trunk\HelloWorld.csproj
Adding D:\tmp\HelloWorld\trunk\MainForm.Designer.cs
Adding D:\tmp\HelloWorld\trunk\Program.cs
Adding D:\tmp\HelloWorld\trunk\MainForm.cs
Adding D:\tmp\HelloWorld\branches
Adding D:\tmp\HelloWorld\tags

Committed revision 1.

Now you have revision 1 checked in. Make sure that in file:/// you use forward slash (/) (file:///d:\svn_rep\myproj\HelloWorld will not work)

6. To have a working copy, you need to checkout latest version. Here is how you do it:

> svn checkout file:///var/svn/myproj/HelloWorld/trunk HelloWorld
A HelloWorld.sln
A HelloWorld.csproj
A MainForm.Designer.cs
A Program.cs
A trunk\MainForm.cs

Checked out revision 1.

So, you have now SVN setup on your PC. Download TortoiseSVN and it will make checkout and checkin much simpler.

Have fun!

Comments

Popular posts from this blog

Printing a C# char array until '\0'

After lot of googling, I finally found that char (or byte) arrays in C# do not have substring search. It has to be a String to do the same. It started with a sample code in MSDN for MemoryStream Class: int count; byte[] byteArray; char[] charArray; UnicodeEncoding uniEncoding = new UnicodeEncoding(); // Create the data to write to the stream. byte[] firstString = uniEncoding.GetBytes( "Invalid file path characters are: "); byte[] secondString = uniEncoding.GetBytes( Path.GetInvalidPathChars()); using (MemoryStream memStream = new MemoryStream(100)) { // Write the first string to the stream. memStream.Write(firstString, 0, firstString.Length); // Write the second string to the stream, byte by byte. count = 0; while (count < secondString.Length) { memStream.WriteByte(secondString[count++]); } // Write the stream properties to the console. Console.WriteLine( "Capacity = {0}, Length = {1}, Position = {2}\n", memStream.Capacity.ToStri...

Sharing files between projects in VS 2008

If you have to share files across projects in VS 2008 all pointing to same file, its quite simple though its kind of hidden. Consider the case I had - required a database access library for both mobile device and windows app. The class files are same. The only difference are type of project (SmartDevice Class Library and Class Library) and references. So, create two projects in one solution and had all class files (.cs) in a separate folder called "src" and used "Add Existing Item..." and added them to both projects. Oops! it created copies in each of project folder. If you want them to add the files as a link, don't just double click target file in "Add Dialog", select it and "Add" button has an option to "Add as Link". So, there you go. Now, both the projects refer to same CS file and its all the more easy now to maintain the source. PS: After googling found this link which helped.