问题
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