AlefSin
AlefSin

Reputation: 1095

How to add a debug visualizer to a VS property sheet?

I'd like to use a library (e.g. Eigen) in many different projects. To make things easier, I have created a property sheet to set the VC++ include paths and other needed settings. Here is an example for Eigen:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros">
    <!-- Installation paths of the package -->   
    <EigenDir>G:\DevLibs\Eigen\Eigen 3.3.3</EigenDir>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="EigenDir">
      <Value>$(EigenDir)</Value>
    </BuildMacro>
  </ItemGroup>
  <!-- Include directories -->
  <PropertyGroup>
    <IncludePath>$(EigenDir);$(IncludePath)</IncludePath>
  </PropertyGroup>
</Project>

One thing that is missing, however, is the C++ debug visualizer. This is a ".natvis" file that has to be added as file item to the project itself (i.e. it goes into the .vcproj file). Currently I have to add it manually each time I create a new project.

Is there a way to add the debug visualizer to the property sheet so that I can keep all these settings (include path, library paths, debug visualizer, etc.) in one place?

Upvotes: 0

Views: 318

Answers (1)

stijn
stijn

Reputation: 35901

Look in the project files which have a .natvis added to them in a text editor: you'll see it's just adding to the Natvis item list. As such adding this to your property should be all that's needed:

<ItemGroup>
  <Natvis Include="NatvisFile.natvis" />
</ItemGroup>

Upvotes: 1

Related Questions