GHT
GHT

Reputation: 5

Postbuild Event in .vcxproj

I am trying to make a postbuild event reference to a .props file in a .vcxproj

What elements fits between the PostBuildEvent Tag?

Although it's not valid i am looking for something like this:

<ItemGroup>
 <PostBuildEvent>  
  <ProjectReference Include="default.props">
  </ProjectReference>
 </PostBuildEvent>
</ItemGroup> 

Upvotes: 0

Views: 1839

Answers (1)

Devin
Devin

Reputation: 87

I don't think you can include a .props file inside an event. Include the props file you want outside the ItemGroup. For example:

<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns='http://schemas.microsoft.com/developer/msbuild/2003' >
  <Import Project="$(VCTargetsPath)\default.props" />
</Project>

In your props file, you can have your PostBuildEvent defined:

<ItemGroup>
 <PostBuildEvent>  
  <Command>copy $(ProjectDir)$(Configuration)\$(TargetFileName) $(ProjectDir)$(Configuration)\copyOfMyproject.exe</Command>
  <Message>Making a copy of myproject.exe</Message>
 </PostBuildEvent>
</ItemGroup> 

The above example is from How to: Use Build Events in MSBuild Projects. Please note that you may need to set the item PostBuildEventUseInBuild in the PropertyGroup in your props file.

Upvotes: 1

Related Questions