"Unable to find any implementation of the contract" Exception in LightSwitch extension
开发者_如何学CI'm teaching myself Visual Studio LightSwitch by porting Excel Importer extension. I have all the pre-requisites (Visual Studio 2010 SP1 Ultimate edition, Visual Studio 2010 SP1 SDK, Visual Studio LightSwitch 2011 Extensibility Toolkit) except that I'm using LightSwitch Beta 2.
While trying to execute this line,
IServiceProxy sdkProxy = VsExportProviderService.GetExportedValue<IServiceProxy>();
I get the following exception:
The composition produced a single composition error. The root cause is
provided below. Review the CompositionException.Errors property for more detailed information.
1) Unable to find any implementation of the contract: 'Microsoft.LightSwitch.Sdk.Proxy.IServiceProxy'
Any idea on how to resolve this?
When you call
IServiceProxy sdkProxy = VsExportProviderService.GetExportedValue<IServiceProxy>();
MEF (Managed Extensibility Framework) will try to find an implementation of the IServiceProxy
interface. It seems that it cannot find any implementation.
Does that help you?
So I managed to solve my problem by doing a complete re-install of Visual Studio 2010 SP1 Ultimate edition, Visual Studio 2010 SP1 SDK, Visual Studio LightSwitch 2011 Extensibility Toolkit and LightSwitch. I tried everything I could think of to avoid this but after finding that the Microsoft samples themselves failed to build with the exact same error, I concluded that some DLL that contained the implementation IServiceProxy was probably out of date or not registered.
I can now build the solution with no issues.
精彩评论