I'm developing in C++ using Visual Studio 2012; I have about 25 projects in a solution that all use the same property sheet (.props
file). I now need every project that uses said props file to also use a specific .targets
file. Instead of editing each of the 25 .vcxproj
files to add an import tag (or adding the import via the GUI for each project), I'd like to put an import statement in the .props
file they all already use. Is this even possible? I've tried adding the import statement that works in the project file to the .props
file just before the closing </Project>
tag, and in a new importgroup at that location, and in the existing but empty importgroup labeled for property sheets at the top of the file, and while there are no errors reported, it doesn't actually do anything with the import statement.
Edit: I'm overriding the predefined PostBuildEvent target in order to pass the IgnoreStandardErrorWarningFormat flag to Exec. My postbuild command runs a batch file which runs some unit tests, and the stdout and stderr output from those tests are parsed by VS for errors according to this post. The IgnoreStandardErrorWarningFormat flag disables this parsing.
Here is the contents of my .targets file:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PostBuildEvent" Condition="'$(PostBuildEventUseInBuild)'!='false'">
<Message Text="Description: %(PostBuildEvent.Message)" Condition="'% (PostBuildEvent.Message)' != '' and '%(PostBuildEvent.Command)' != ''"/>
<Exec IgnoreStandardErrorWarningFormat="True" Command="% (PostBuildEvent.Command)$(_BuildSuffix)" Condition="'%(PostBuildEvent.Command)' != ''"/>
</Target>
</Project>