views:

934

answers:

1

Hi,

I'm trying to get our build scripts (which use MSBuild) working correctly on Vista and am finding that projects that have the Register Output (in linker options) option set to True fail to build from the command line with something like this:

Project : error PRJ0050: Failed to register output. Please try enabling Per-user Redirection or register the component from a command prompt with elevated permissions.

Although I can easily fix this for a single machine, by running as admin or whatever I want the build script to "just work" for any dev machine.

Even to just fail the registration but have the build continue would be satisfactory. Any suggestions?

Brad

+2  A: 

You could create cmd-file that will be contain the following text:

@echo off
call regsvr32.exe /s %1
if %errorlevel% EQU 0 goto ok
echo Fail to register %1
goto exit
:ok
echo Register successful %1
:exit

After that you should switch off registering output and one should add Custom Build Step with command <pathtocmdscript> $(TargetPath). Output one should set to $(TargetPath) for Custom Build Step.

Finally you'll got message about registering progress, but compilation will not stop on that step.

Kirill V. Lyadvinsky