Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8561175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:26:37+00:00 2026-06-11T16:26:37+00:00

I am writing a VS 2012 plug-in, which contains a Package as well as

  • 0

I am writing a VS 2012 plug-in, which contains a Package as well as an IWpfTextViewCreationListener MEF extension class.

It is installed using a WiX project created MSI, placing all of the files in C:\Program Files\...[Application]; which creates the Packages registry entry to point to the DLL containing the Package implementation.

When debugging the plug-in in an experimental Visual Studio instance, everything runs correctly.

When running the MSI installer, the Package code runs fine, but the MEF class is not instantiated.

Note: if I install the package using the VSIX (which I do not use for MSI install) everything also works fine.

The MEF class (in same Assembly as Package):

[Export(typeof (IWpfTextViewCreationListener))]
[ContentType("text")]
[TextViewRole(PredefinedTextViewRoles.Document)]
internal sealed class HighlightAdornerFactory : IWpfTextViewCreationListener
{
    [Import]
    public IClassificationTypeRegistryService ClassificationRegistry = null;

    [Import]
    public IClassificationFormatMapService FormatMapService = null;

    [Export(typeof (AdornmentLayerDefinition))]
    [Name(HighlightAdornment.Name)] 
    [Order(After = PredefinedAdornmentLayers.Selection, Before = PredefinedAdornmentLayers.Text)]
    public AdornmentLayerDefinition editorAdornmentLayer = null;
 public void TextViewCreated(IWpfTextView textView)
    { /** ... **/ }
}

I used VisualMEFX to examine the DLL that this is packaged in. It reports that no exports match IClassificationTypeRegistryService. This doesn’t explain why it works when installed with VSIX, or debugged via the IDE. But it might be useful to know in troubleshooting the problem.

  [Export] MySolution.HighlightAdornerFactory (ContractName="Microsoft.VisualStudio.Text.Editor.IWpfTextViewCreationListener")
  [Export] MySolution.Adornment.HighlightAdornerFactory.editorAdornmentLayer (ContractName="Microsoft.VisualStudio.Text.Editor.AdornmentLayerDefinition")
  [Import] MySolution.Adornment.HighlightAdornerFactory.ClassificationRegistry (ContractName="Microsoft.VisualStudio.Text.Classification.IClassificationTypeRegistryService")
    [Exception] System.ComponentModel.Composition.ImportCardinalityMismatchException: No exports were found that match the constraint: 
    ContractName    Microsoft.VisualStudio.Text.Classification.IClassificationTypeRegistryService
    RequiredTypeIdentity    Microsoft.VisualStudio.Text.Classification.IClassificationTypeRegistryService
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition)
   at Microsoft.ComponentModel.Composition.Diagnostics.CompositionInfo.AnalyzeImportDefinition(ExportProvider host, IEnumerable`1 availableParts, ImportDefinition id) in C:\Temp\MEF_Beta_2\Samples\CompositionDiagnostics\Microsoft.ComponentModel.Composition.Diagnostics\CompositionInfo.cs:line 157
  [Import] MySolution.HighlightAdornerFactory.FormatMapService (ContractName="Microsoft.VisualStudio.Text.Classification.IClassificationFormatMapService")
    [Exception] System.ComponentModel.Composition.ImportCardinalityMismatchException: No exports were found that match the constraint: 
    ContractName    Microsoft.VisualStudio.Text.Classification.IClassificationFormatMapService
    RequiredTypeIdentity    Microsoft.VisualStudio.Text.Classification.IClassificationFormatMapService
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition)
   at Microsoft.ComponentModel.Composition.Diagnostics.CompositionInfo.AnalyzeImportDefinition(ExportProvider host, IEnumerable`1 availableParts, ImportDefinition id) in C:\Temp\MEF_Beta_2\Samples\CompositionDiagnostics\Microsoft.ComponentModel.Composition.Diagnostics\CompositionInfo.cs:line 157

I have tried adding all the referenced libraries from my assembly into the MSI, but this did not help. I am not seeing any exceptions being thrown, the IWpfTextViewCreationListener class simply does not get loaded.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:26:38+00:00Added an answer on June 11, 2026 at 4:26 pm

    The behavior you are seeing is by design; assemblies are included in the MEF composition only if they’re listed in a .vsixmanifest somewhere. When you added the Package registry keys through your MSI, this will not add your assemblies to the MEF composition. When were you were testing in the experimental hive or installing the extension directily, you were including your assembly into the MEF composition as you expected.

    You have a few ways to fix this, in my order of recommendation:

    1. Don’t use an MSI. I strongly encourage this if possible. VSIXes are quite powerful, and offer many advantages for the user: they are easier to install and uninstall, and they integrate with the extension manager and Visual Studio gallery. Unless you can prove that a VSIX is unacceptable for your scenario, please use them.

    2. Use WiX 3.6, which has a VsixPackage element which will install your VSIX for you. The documentation is available here.

    3. Have your MSI install the contents of your VSIX into [Program Files]\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\[Your Product Name] and then run devenv /setup as a part of a custom action. This is very tricky to do and requires a bunch of manual WiX authoring. Option #2 exists for a reason — the WiX folks actually know what they’re doing. 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm showing the text using ul and li tag. <ul class=archive-item-list-pt> <li><a href=/blogs/2012/9/22/reading-and-writing.html>Reading and
It's 2012. I'm writing some code in C. Should I be still be using
I'm writing a MVC4 Website using Microsoft Visual Studio express 2012 for web. Whenever
Writing a python program, and I came up with this error while using the
Writing an asynchronous Ping using Raw Sockets in F#, to enable parallel requests using
I am writing a Python script to do some admin functionality which involves running
I am writing an application which needs to add nodes to an existing XML
Lets say I've got a file in D: which has a filepath as: D:\work\2012\018\08\2b558ad8-4ea4-4cb9-b645-6c9a9919ba01
I'm writing a simple generic logger class, that is aware of time started and
I have been writing a plug-in for Maya with C++. The Makefile I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.