Hello I have a managed package that provides the code for a custom C++ build toolchain. I have a custom platform Toolset.targets that loads some custom properties:

<ItemGroup>
    <PropertyPageSchema Include="$(MSBuildThisFileDirectory)projprops.xml" />
</ItemGroup>

projprops.xml looks like the following:

<?xml version="1.0" encoding="utf-8"?>
<Rule Name="MyGeneralProperties"
  Order="9"
  DisplayName="MyRule"
  Description="General"
  PageTemplate="generic"
  xmlns="http://schemas.microsoft.com/build/2009/properties">
    <Rule.Categories>
        <Category Name="General" DisplayName="General" Description="General" />
    </Rule.Categories>
    <Rule.DataSource>
        <DataSource Persistence="UserFile"/>
    </Rule.DataSource>

    <DynamicEnumProperty Name="BuildMachine" DisplayName="Build Machine" Category="General" EnumProvider="BuildMachines" Visible="True" Description="The machine that building and debugging will take place on."/>
</Rule>

I have my enum provider in the same DLL as the package and it looks like this:

[Export(typeof(IDynamicEnumValuesProvider))]
[DynamicEnumCategory("BuildMachines")]
public class BuildMachineEnumProvider : IDynamicEnumValuesProvider
{
    // the implementation
}

An instance of BuildMachineEnumProvider is never created by the runtime however the property shows up in the VC project properties right where it's supposed to. The package loads as it should when a solution is loaded via [ProvideAutoLoad(UIContextGuids80.SolutionExists)]. According to everything I've read MEF should recognize my enum provider class when the package is loaded and everything else should just work - except it doesn't.

1

There are 1 answers

1
Pawel Hofman On BEST ANSWER

You need to mark your VSPackage as MEF-enabled.

Check for details here: Does anyone know how to implement the DynamicEnumProperty type for C++ Project Property rules