# check what sort of build we are doing
 
 my $bconf     = $ENV{CONFIG} || "Release";
+my $msbflags  = $ENV{MSBFLAGS} || "";
 my $buildwhat = $ARGV[1]     || "";
 if (uc($ARGV[0]) eq 'DEBUG')
 {
 if ($buildwhat and $vcver >= 10.00)
 {
        system(
-               "msbuild $buildwhat.vcxproj /verbosity:normal /p:Configuration=$bconf"
+               "msbuild $buildwhat.vcxproj $msbflags /verbosity:normal /p:Configuration=$bconf"
        );
 }
 elsif ($buildwhat)
 {
-       system("vcbuild $buildwhat.vcproj $bconf");
+       system("vcbuild $msbflags $buildwhat.vcproj $bconf");
 }
 else
 {
-       system("msbuild pgsql.sln /verbosity:normal /p:Configuration=$bconf");
+       system("msbuild pgsql.sln $msbflags /verbosity:normal /p:Configuration=$bconf");
 }
 
 # report status
 
 
 sub ecpgcheck
 {
+       my $msbflags  = $ENV{MSBFLAGS} || "";
        chdir $startdir;
-       system("msbuild ecpg_regression.proj /p:config=$Config");
+       system("msbuild ecpg_regression.proj $msbflags /p:config=$Config");
        my $status = $? >> 8;
        exit $status if $status;
        InstallTemp();