Using SVN for source control in Visual Studio

Source: Internet
Author: User
Tags http authentication svn tortoisesvn

For a slightly larger project I think it is necessary to use the source code management tools, today we will gradually talk about the use of SVN.

Configuration of Subversion+tortoiessvn

1. Install Subversion. (Download Address:http://subversion.tigris.org/servlets/projectdocumentlist?folderid=8100&expandfolder=8100& folderid=91), for example I install to d:/svn/subversion

2. Install TORTOISESVN. (Download Address: http://tortoisesvn.net/downloads), this is a subversion of the image management tool, no it can, but management subversion need to use the form of command line, TORTOISESVN can be installed in the right key menu to the appropriate options. For example, I installed the D:/SVN/TORTOISESVN

3. Build a version library (repository). As with VSS, we need a library to store version information. There are two ways to create them through the Subversion command line or through the TortoiseSVN graphical interface. We create it directly through TORTOISESVN, for example, I want to set up a folder in D disk Svnservices used to place the version library, and then build a Emidata folder as my project EMI version library, This is my right click on Emidata--tortoisesvn-create Repository here will emidata the most version of the library, this is you will find Emidata folder more than a lot of files.

4. Start SVN service. Here our subversion has not actually started, we are in cmd command line input: Svnserve–-daemon–-root d:/svnservices So we can start SVN and take d:/svnservices as the root directory. Here I want to specify a few points, the first is that the input of the command in both two '-', that is, '-' and not '-'; the 2nd is to start the cmd window so that can not be closed, this is similar to Tomcat's command window, But like Tomcat, we'll talk about a better way of not having to keep the window open all the time.

I'm here to check if the library you just built is correct, hit open tortoisesvn--repo-browser at the URL and enter Svn://localhost/emidata If you see emidata this empty library, it means you have successfully built a library of versions.

5. Assign user rights. Our SVN server is not accessible to anyone, and certainly requires permissions to be configured. Open d:/svnservice/emidata/conf/svnserve.conf with a text editor we'll change # password-db = passwd to: password-db =passwd That means we use password validation, The point here is that the space behind the # will also be removed. Then we modify the same directory under the passwd file, add a jianxin160 account, under [Users] This section to add jianxin160=123456, that is, username, password is 123456.

6. Import the project into the version library. For example my project EMI in F:/emi This folder, I pass the right button Tortoisesvn-import ... In the pop-up dialog box at the URL to enter "Svn://localhost/emidata/emi", click OK to enter our username and password above (jianxin160 and 123456).

Apache Setup SVN service

Through the above operation we can actually manage the project, and you have found that we can actually view the project file in TortoiseSVN's repo-browser by entering Svn://localhost/emidata/emi. In fact, SVN's own server can be version-managed. But if we enter svn://in Visual Studio ... To import and manage our project is somewhat inadequate, and usually look to rely on the tortoisesvn of the Repo-browser, and still have to open the cmd window more trouble. There's no better way, yes, that's what we do with the Apache server.

7. Install Apache. (Download here: http://httpd.apache.org/download.cgi) For example, my installation to the D:/svn/apache, the installation process is relatively simple I will not say.

8. Associate Apache and SVN. Apache is not aware of SVN, certainly also can not manage it. Intl3_svn.dll,libdb44.dll,mod_authz_svn.so,mod_dav_ in the bin directory in the Subversion installation directory svn.so Copy to the Apache installation directory modules, locate the httpd.conf file in Apache's Conf folder, and remove the "#" number in front of #loadmodule dav_module modules/mod_dav.so. Then add the following: LoadModule dav_svn_module modules/mod_dav_svn.so Note that it must be placed behind the line immediately following it. But at this point, Apache doesn't know how to handle it, we add it at the end of the httpd.conf

DAV SVN

Svnpath D:/svnservices/emidata

This is what we can do by typing in the browser: Http://127.0.0.1/repository/EMI to browse our project. You can see that by using Apache we mapped the path accordingly.

9. Configure the Apache authentication method. We can enter Http://127.0.0.1/repository/EMI to visit our project until the last step, of course. We are here to protect the project through the basic HTTP authentication of Apache. There is a htpasswd tool in the Apache Bin directory, through which we create user information. For example: through the command line htpasswd-c d:/svnservices/emidata/myapacheuser/passwd.conf jianxin160 and then prompted to enter the password, I entered 123456 re-enter, will be in d:/ Svnservices/emidata/myapacheuser (previously established myapacheuser this directory) creates a file passwd.conf contains passwords that are encrypted with MD5. Create a user by Htpasswd-m d:/svnservices/emidata/myapacheuser/passwd.conf miaoer1987. I will not dwell on the htpasswd operation. Then modify the Apache httpd.conf and add the following in the Location tab (which we added above):

AuthType Basic
AuthName "SVN repos"
AuthUserFile d:/svnservices/emidata/myapacheuser/passwd.conf
Require Valid-user

This is the second input Http://127.0.0.1/repository/EMI will require a username password.

10. Install ANKHSVN. (Download Address: http://ankhsvn.open.collab.net/downloads) This is a Visual Studio plug-in, and with it the combination of SVN and Visual Studio is even more seamless. After the installation, I found out that in VS, File-open has one more option, "SubVersion Project," where we enter http://127.0.0.1/repository/ EMI will be able to see our solution file (after my first input only http://127.0.0.1/repository, turn off vs and open to see http://127.0.0.1/repository/ EMI) EMI.sln open to download the entire project to the local, then notice to enter in the location where you want to save the copy. Okay, this is where the entire SVN configuration ends.

A little something to add

SVN configuration Note

1. Following the above, others are still unable to use, the reason is very simple, 127.0.0.1 such an IP can not find your SVN server. Solution: If you are in the LAN to replace your IP in the LAN, if it is static IP (rarely) only need to replace your static IP, if you are in the WAN and there is no static IP so you can pass the domain name (this situation requires a virtual host), If you do not have a virtual host and have no static IP and need to use the Dynamic Domain name binding tool in the WAN to implement.

2. Use the firewall in the local area network to close SVN's machine. (When the client connects to the SVN server, it is best to ping and then enter the corresponding address in the browser to try, if found that Ping does not pass the other host is likely to be a firewall problem, attention includes a variety of firewalls)

The use of SVN

1. Using SVN, after adding a project to VS, you do not need to open it every time from File--open-subversion project, only to open the corresponding solution file directly in the copy.

2. When you edit a file, SVN automatically locks it up and the editor remembers the commit.

3. When closing vs if there is no commit file, the next open can also commit.

4. A new version is recommended each time you open vs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.