I am trying to create an excel add-in using Visual Studio 2013. The add-in is for Excel 2010.
Now the issue I am facing... I am not able to run the add-in in debug mode. When I click "Start" to debug my code, Excel opens and closes immediately. This issue does not have anything to do with my project, because the issue happens even when I create a fresh add-in project without any code.
The following message is displayed in the output window.
'excel.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Symbols loaded.
The program '[10116] excel.exe: Program Trace' has exited with code 0 (0x0).
The program '[10116] excel.exe' has exited with code -2146233082 (0x80131506).
Try opening Excel first instead of using 'Start' to debug, then from your Visual Studio solution click on the Debug menu > 'Attach to Process' and select EXCEL.EXE from the list of available processes.
This works for me as I also have the Office app quit on me when using 'Start'
Symptom:
In Visual Studio, Debugging (F5) a VSTO Add-In launches Excel and then the Excel process crashes.
Solution:
Create an XML file called Excel.Exe.Config:
<configuration>
<startup>
<supportedRuntime version="v2.0.50727"/>
<supportedRuntime version="v1.1.4322"/>
<supportedRuntime version="v1.0.3705"/>
</startup>
</configuration>
The versions must match what you find in C:\Windows\Microsoft.Net\Framework.
Place Excel.Exe.Config in the folder that contains Excel.exe, eg:C:\program files\Microsoft Office\Office14
If using .Net 2 resolves the problem you can narrow it down to .Net 4.5 by seeing if .Net 4 will work, eg:
<supportedRuntime version="v4.0.30319"/>
If the above doesn't work please enable VSTO logging as I discuss here (#7) and is detailed in depth here and add those details to your question.
Edit:
I have this vague memory of something similar happening to me, I should have documented it - make sure the Office VSTO Runtime installed on the PC?
You don't have multiple versions of Office installed do you? That is not supported as per: http://blogs.msdn.com/b/andreww/archive/2007/06/08/why-is-vs-development-not-supported-with-multiple-versions-of-office.aspx
Try it on another PC? Does it work - if so its PC specific and you should do a repair &/or uninstall/reinstall of Office and Visual Studio
Make sure you can debug other applications like winform app? And you can debug a Word or Outlook Add-In?
It's a long shot (and I understand its Visio not Excel) but is EMET installed: https://social.msdn.microsoft.com/Forums/vstudio/en-US/c259df5b-d76c-4de4-86c9-6690522cd9b8/visio-crashes-when-debugging-addin-in-visual-studio?forum=vsto
If the above fail more in depth troubleshooting is required. Setup Adplus to take a Crash using the -pn switch set to Excel. Reproduce the problem then open the Memory Dump in windbg and issue a !analyze command.
Check the project target framework may be project is targeting .Net framework 4.5 try changing target framework to .Net framework 4
User contributions licensed under CC BY-SA 3.0