Skip to content

Can't import: MyPostProcessor: No export was found for the contract 'IPostProcessor "MyPostProcessor"' #9246

@michfuchs

Description

@michfuchs

DocFX version: 2.70.3
Project built with .NET Core SDK 7.0.401 (also tried .NET 6.0, same behaviour)

Reproducing the issue:

  1. Follow the instructions in the Documentation.
  2. Copy the generated assembly to templates/my-template/plugins
  3. Build the site

Observed behavior:

  • Exception message (see below), PostProcessor does not work

Expected behavior:

  • PostProcessor is picked up as the documentation would suggest

Others seem to struggle with the issue as well:

Discussed in #9239

Originally posted by michfuchs September 25, 2023
One appraoch to solve #9238 seems to be implementing a custom PostProcessor, as described in the Documentation.

image

However, I don't seem to be able to load my post processor.

My docfx.json configuration for the post processors looks like this:

"postProcessors": [ "ExtractSearchIndex", "MyPostProcessor" ]

Since ExtractSearchIndex works, I'm confident it's in the right spot.

Step 4 in the documentation specifies where the built dll of the assembly containing the preprocessor should be copied to:
image

I tried several folder options, none seem to work:
image
image
image
image

I am consistently getting the following error:

1>Searching custom plugins in directory ****\802_Documentation\templates\my-template\plugins...
1>6 plug-in(s) loaded.
1>Post processor ExtractSearchIndex loaded.
1>EXEC : warning : Can't import: MyPostProcessor, System.Composition.Hosting.CompositionFailedException: No export was found for the contract 'IPostProcessor "MyPostProcessor"'.
1>   at System.Composition.CompositionContext.GetExport(CompositionContract contract)
1>   at System.Composition.CompositionContext.GetExport(Type exportType, String contractName)
1>   at Docfx.Common.CompositionContainer.GetExport(CompositionHost container, Type type, String name) in /_/src/Docfx.Build.Engine/CompositionContainer.cs:line 41
1>EXEC : warning : Can't find the post processor: MyPostProcessor

It was always 6 plug-ins, even before I added the processor, so the plug-in is definitely not picked up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    extensibilityExtend the platform to support new languages, new outputs and custom behaviors

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions