How to disable MSBuild <RegisterOutput> target environment for each user?
I like to do my development as a regular (non-admin) user. Our VS2010 project does not work with "Failed to register output. Try enabling redirection for each user or register the component from the elevated command prompt."
Since I cannot change the project file , is there a way I can add MSBuild targets or properties for a specific user that disabled this step on a specific machine, or for a specific user? I would prefer not to crack the core MSBuild files.
I do not want to modify the project file, because then I could accidentally check it. I also do not want to hack the core MSBuild files because they can be overwritten by the service pack.
Given that the Visual C ++ project files (and their associated .targets and .props files) have about a million places to change the assembly order and to import arbitrary files, I was hoping for something in these lines.
MSBuild imports / evaluates the project file as follows (I looked only at the branches that interest me):
Foo.vcxproj Microsoft.Cpp.Default.props Microsoft.Cpp.props $(UserRootDir)\Microsoft.Cpp.$(Platform).user.props Microsoft.Cpp.targets Microsoft.Cpp.$(Platform).targets ImportBefore\* Microsoft.CppCommon.targets The purpose of "RegisterOutput" is defined in Microsoft.CppCommon.targets . I was hoping to replace this by setting the "RegisterOutput" do-nothing target to $(UserRootDir)\Microsoft.Cpp.$(Platform).user.props , which is %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props (UserRootDir is installed in Microsoft.Cpp.Default.props , if it is not already installed).
Unfortunately, MSBuild uses an end goal, which means mine gets an overridden inline.
Alternatively, I could try setting the %(Link.RegisterOutput) metadata %(Link.RegisterOutput) , but I would have to do this on all Link elements. Any idea how to do this, or even if it will work?
madgnome suggested that I can do something in the .vcxproj.user file. Unfortunately, this is at the beginning of the assembly process, which means that replacing the target will not work.
Final decision
RegisterOutput is called during the communication process defined by $ (BuildLinkTargets) (Microsoft.CppBuild.targets) as follows:
<BuildLinkTargets Condition="'$(ConfigurationType)'!='Utility'"> $(BuildLinkTargets); _Link; _ALink; _Manifest; RegisterOutput; _XdcMake; _BscMake; </BuildLinkTargets> If you do not want to perform RegisterOutput, you just need to remove this step in the BuildLinkTargets definition:
<PropertyGroup> <BuildLinkTargets Condition="'$(ConfigurationType)'!='Utility'"> $(BuildLinkTargets); _Link; _ALink; _Manifest; _XdcMake; _BscMake; </BuildLinkTargets> - If you do not want to execute RegisterOutput for one project , you need to redefine it in the file: PROJECT_NAME.vcxproj.user (next to your project file, this file depends on the user and the project)
- If you never want to execute RegisterOutput in your entire project , you need to override it in the file: $ (UserRootDir) \ Microsoft.Cpp. $ (Platform) .user. props (this file is user-specific)