Excel VSTO Add-in error - application domain could not be created

孤街浪徒 提交于 2019-12-06 05:49:41

On Windows 7 64-bit, we had a similar issue. Some of the referencing errors were:

Not loaded. A runtime error occurred during the loading of the COM Add-in.

Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateCustomizationDomainException: Customization could not be loaded because the application domain could not be created.

System.TypeLoadException: Could not load type 'System.AddIn.Pipeline.QualificationDataAttribute' from assembly 'System.AddIn.Contract, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

This issue was caused by corruption in Microsoft .NET Framework 3.5.1, which is a feature of the operating system.

How to Repair or Reinstall .NET Framework 3.5 http://www.adminarsenal.com/admin-arsenal-blog/how-to-repair-or-reinstall-net-framework-3-5/

This post claims that the full .NET framework (as opposed to the client profile) must be installed when encountering this exception. Several people state that this fixed the problem for them.

(Ideally your VSTO should only require the client profile framework. Are you doing something in your VSTO that requires the full framework, or is that one of the prerequisites?)

Ok - well turns out it was something wrong with the users machine. Had the user uninstall my add-in and enable other ones on his machine and the error message still appeared. Time to troubleshoot him machine instead of my add-in!

As a note for other people, you can see the error messages by unsuppressing error messages from adding a variable into Environment Variables -> System Variables

Variable Name: VSTO_SUPPRESSDISPLAYALERTS

Variable Value: 0

FINAL UPDATE:

Turns out the user has Microsoft Office Professional Plus 2010 and Visual Studio is unable to produce add ins for this version of Microsoft Office.

https://connect.microsoft.com/VisualStudio/feedback/details/687449/vsto-not-compatible-with-office-professional-plus-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!