System.Reflection.ReflectionTypeLoadException with

2019-07-13 00:16发布

问题:

I am using EF4 in windows form app. I got a problem whenever I run a release file in machine which doesn't have visual studio 2010 installed I always got this error :

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information

So far, the only workaround is install VS 2010 and rebuild solution in order to make the release run. It's so annoying, I wonder if there is a better solution.

回答1:

assuming you have the correct client profile installed on the client machine you might have dependencies to frameworks that are not in the base installation and need to be included as part of your deployment to the client.

You can quickly verify by selecting all the referenced dlls and setting Copy Local=True

And testing everything in the bin on a client machine.



回答2:

maybe on machine without VS is not installed framework 4.0? or in "target framework" on settings project set "full framework", but must set "client framework 4.0 or 3.5".

sorry for my bad English.



回答3:

Sorry, just remove the "buildProviders" block. It will probably work =)