0

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?

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

2 Comments

Fantastic! It works. It didn't occur to me that <ItemGroup> items will be virtually merged into the .vcproj
Property sheets, although named differently, are just standard msbuild files which are imported using the standard msbuild Import which roughly is equivalent to pasting the text into the project file at the location of the import.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.