how do I easily test the case where my C# application can't find an external assembly?

安稳与你 提交于 2019-12-13 16:56:36

问题


So I have a C# application and part of it references the microsoft office interop assemblies. I'd like to gracefully handle the case that the user doesn't have office installed, but to do so, I need to be able to test the case that office is not installed. Short of uninstalling office, or actually uninstalling these assemblies on my machine, is there an easy way to test this? I found the assemblies in C:\Windows\assembly, but it doesn't look like there's an easy way to rename them or move them temporarily (at least not in Windows 7). i.e. Can I fake out my application to believe that these assemblies aren't installed so I can test this code path? Thanks for any help you can provide.


回答1:


Short of uninstalling office, or actually uninstalling these assemblies on my machine, is there an easy way to test this?

Test it on one of your testing vm's ;)



来源:https://stackoverflow.com/questions/9810772/how-do-i-easily-test-the-case-where-my-c-sharp-application-cant-find-an-externa

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