Hi,
I get InvalidCastException saying "Unable to cast object of type 'x' to type 'x'". x is a custom type I created. The whole story is:
I have a VS extension package which exposes a service, this service has a method GetChildService<T>(). GetChildService<T>() is supposed to return an service instance of type T. Inside GetChildService<T>(), there is a line of code: return (T)_services[key]; this line throws the exception.
With the help of debugger, I find 2 assemblies are loaded for the same custom type, one is from install folder, one is from "C:\Documents and Settings\my name\Local Settings\Application Data\Microsoft\VisualStudio\8.0\ProjectAssemblies", apparently a cached copy created by VS 2005.
I tried cleaning up all the cached assemblies, but VS always make new copy. I even tried set "Copy Local" of the assembly reference to false, did not make any difference.
Can somebody tell me how to force VS 2005 to load custom assemblies from a specified folder?
Thanks a lot!
Michael