diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index a1eb2af64b4831677d05369776256ea0b46012f2..54a60f72d3c9df1fdb1e2e561cb67dd5c96af953 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -3,7 +3,7 @@ package Mkvcbuild;
 #
 # Package that generates build files for msvc build
 #
-# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.15 2007/07/23 10:16:54 mha Exp $
+# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.16 2007/08/21 15:10:41 mha Exp $
 #
 use Carp;
 use Win32;
@@ -70,6 +70,13 @@ sub mkvcbuild
     $postgres->AddLibrary('wldap32.lib') if ($solution->{options}->{ldap});
     $postgres->FullExportDLL('postgres.lib');
 
+    my $snowball = $solution->AddProject('dict_snowball','dll','','src\backend\snowball');
+    $snowball->RelocateFiles('src\backend\snowball\libstemmer', sub {
+        return shift !~ /dict_snowball.c$/;
+    });
+    $snowball->AddIncludeDir('src\include\snowball');
+    $snowball->AddReference($postgres);
+
     my $plpgsql = $solution->AddProject('plpgsql','dll','PLs','src\pl\plpgsql\src');
     $plpgsql->AddFiles('src\pl\plpgsql\src','scan.l','gram.y');
     $plpgsql->AddReference($postgres);
diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index 0d4f486a60b9913ff453bffc7408a2cf80101317..23749844e6d5bc585a986bfc41dc1e6a38fb35dc 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -3,11 +3,12 @@ package Project;
 #
 # Package that encapsulates a Visual C++ project file generation
 #
-# $PostgreSQL: pgsql/src/tools/msvc/Project.pm,v 1.13 2007/07/25 10:51:03 mha Exp $
+# $PostgreSQL: pgsql/src/tools/msvc/Project.pm,v 1.14 2007/08/21 15:10:41 mha Exp $
 #
 use Carp;
 use strict;
 use warnings;
+use File::Basename;
 
 sub new
 {
@@ -96,6 +97,18 @@ sub RemoveFile
     confess("Could not find file $filename to remove\n");
 }
 
+sub RelocateFiles
+{
+    my ($self, $targetdir, $proc) = @_;
+    foreach my $f (keys %{$self->{files}}) {
+        my $r = &$proc($f);
+        if ($r) {
+           $self->RemoveFile($f);
+           $self->AddFile($targetdir . '\\' . basename($f));
+        }
+    }
+}
+
 sub AddReference
 {
     my $self = shift;