Adding build actions to a project for a file with a custom extension RRS feed

  • Question

  • I want to have vs set up some build actions in a C++ project when I add a file with a custom extension. For example, suppose I add the file Test.evt. I want to run a batch file on this to code generate .h and .rc files to be included in the project. The project file would include a section looking something like:

      <None Include="etw\Test\resources\MSG00001.bin">
      <None Include="etw\Test\resources\TestTEMP.BIN">
      <CustomBuild Include="Test.evt">
        <Command>copy %(Identity) %(Filename).h</Command>
        <Command>buildevents.cmd  %(Identity)  %(Filename) %(RootDir)%(Directory)</Command>
      <ClInclude Include="Test.h">
      <ResourceCompile Include="etw\Test\resources\Test.rc">

    This is basically what happens in C# project when a .tt file is added.

    What is the recommended way to achieve this?


    Bill Hay

    Wednesday, October 10, 2012 3:05 PM