views:

8475

answers:

4

At work, we have a windows server 2003 with IIS and Subversion installed. We use it to publish and test locally our ASP.NET websites. Every programmer has Tortoise installed on his PC and can update/commit content to the server. Hosting the repositories is working fine. But the files kept in those repositories needs then to be copied to our local IIS (virtual directories).

What is an easy way to publish those subversion repositories to our local IIS?

Edit:
Thanks to puetzk I added a simple bat file that gets executed every time a commit occurs (check the subversion documentation about hooks). My bat file only contains:

echo off
setlocal

:: Localize the working copy where IIS points)
pushd E:\wwwroot\yourapp\trunk
:: Update your working copy
svn update

endlocal
exit
+5  A: 

SVN doesn't support IIS; you can however run the standalone svnserve server as a windows service.

There's the SVN FAQ entry about it, and this blog post on Vertigo Software blog may be helpful too.

UPDATE: After your clarification, I see that what you are looking for is a way to automatically update the code on the server after it's checked in. Look into CruiseControl.NET, after looking at the subversion integration tutorial it looks like it should do what you want.

UPDATE 2: This tutorial describes integrating Subversion, CruiseControl.NET and Nant.

Aeon
Unless I misunderstand, @jdecuyper is looking for a way to publish the contents of his repository, not a way to host it.
puetzk
@puetzk is right. I edited my question for more clarity.
jdecuyper
Ah, I think I misunderstood. In that case @puetzk's answer is absolutely right. You can also use a continuous integration toolkit for that; I'm adding that to my response.
Aeon
@Aeon, thanks for the update!
jdecuyper
+12  A: 
  1. Just keep the web server's file area as a working copy, and perform an svn up in it whenever you want to "publish". Configure it to hide the contents of the .svn folders if they seem untidy to you (I don't specifically know how to do this, but I assume it can be done). They will already have the filesystem hidden bit, which may take care of this.

  2. If you want it really automatic (updates as soon as someone commits), use a post-commit hook script on the SVN server to kick off the first process.

Others in the comments have suggested using export instead of checkout. That can work too, and avoids the .svn clutter, but has two drawbacks. One, it has to redownload the entire contents every time, not just the modified files (since it didn't keep the .svn dir to remember what it has). If you have a lot of files, this will be much slower. Two, update replaces the file atomically (writes the new version in .svn/tmp, then moves it into place). Export writes the file gradually into it's destination as it downloads. That means export could deliver an incomplete file to someone who browsed it at just the wrong time.

puetzk
That would work fine. I might take it one step further and create a NANT script to do that work for you, possibly doing a SVN export instead of a checkout.
JKueck
I'm a fan of storing the Nant scripts as part of the project. Check out http://www.dimecasts.net/Casts/ByTag/NAnt.
JKueck
@puetzk: Thanks a lot for great help!
jdecuyper
Good points on the export. I've never used it that way in practice (I let Nant do all the dirty work), but thought it was worth mentioning. I'd add that export would also require you to clean out the existing files first, where as an update would do this work for you.
JKueck
+1  A: 

Use can use the free Visual-SVN Server to quickly install Subversion with Apache front end. It also have a nice MMC snap-in for managing the server and repositories.

You will than be able to access subversion with HTTP or HTTPS, but the port number must be different from the one your local IIS uses (default port for Visual-SVN server is 8080).

If you really need to access the repositories using your local IIS port 80, you can try SVN-IIS which acts as a bridge between your IIS and Apache. I haven't tried this one myself though.

zvikara
We are actually using Visual-SVN Server (which is great by the way) and can access our files trough HTTP (port 8443). But aspx files are not served (only displayed in plain text) and we need them to be processed.
jdecuyper
+1  A: 

Hello all,

maybe SVNIsapi can solve the problem (http://www.svnisapi.com). Cause it only utilizes an IIS installation, therefore you don't need an APACHE server or an SVNSERVER service. Secondly it should be possible to stack the ASP.NET ISAPI plugin onto the processing of SVNISAPI, so that a ASP.NET (.aspx) page will interpreted after read from the repository.

Cheers Paolo

Simon D