.Net, Troubleshooting, Visual Studio

How To Fix “no exports were found that match the constraint” In Visual Studio

So, you have that “no exports were found that match the constraint” message in Visual Studio, eh?

The first thing I would try doing on the affected version of visual studio is to go to programs and features, select the version and pick change: VSbugss3

When that loads let it repair. Once it does see if that resolves the issue.

VSbugss2

If it does not a more manual method that is to delete all of the contents of the ComponentModelCache folder from the following area (of which VS version is affected):

Put your username in the path:

VS 2012:

C:\Users\username\AppData\Local\Microsoft\VisualStudio\11.0\ComponentModelCache

VS 2013:

C:\Users\username\AppData\Local\Microsoft\VisualStudio\12.0\ComponentModelCache

VS 2015:

C:\Users\username\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

It should look something like:

VSbugss1

If that fails there is also a patch that they released in response: https://www.microsoft.com/en-in/download/confirmation.aspx?id=36020#

Sitecore, Sitecore Rocks, Troubleshooting, Visual Studio

Getting “Error: this template attempted to load component assembly Sitecore.Rocks.TemplateWizard…” ? Try this…

At some point in your early Sitecore career you will likely encounter the following error:

sitecorerockserror

Perhaps you tried uninstalling and reinstalling Sitecore Rocks but still had the issue? Here’s what happened in my battle with troubleshooting.

So I finally went and found the Sitecore.Rocks.TemplateWizard.dll and copied it to:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies

If you have trouble finding where those assemblies are then look where the extension was installed. For me it was starting here

C:\Users\username\AppData\Local\Microsoft\VisualStudio\12.0\Extensions

Once there I browsed the directories until I found it.

(Others I know have had to copy to Visual Studio 10 and 11 as well)

These steps did fix the issue and allowed the template wizard to run when creating a layout.

If you are still receiving other errors after this you may need to also bring in some other files. What was missing was a good number of other dlls:

  • Sitecore.Rocks.Validation.dll
  • Sitecore.Rocks.Validation.Runner.config.xml
  • Sitecore.Rocks.Validation.Runner.exe
  • Sitecore.Rocks.Validation.Runner.exe.config
  • Sitecore.Rocks.VisualStudio.dll
  • Sitecore.Rocks.VisualStudio.pkgdef
  • (and of course Sitecore.Rocks.TemplateWizard.dll)

After copying these out to the folder mentioned above and restarting Visual Studio, my issue was resolved. Hope that helps.