Exception: Error HRESULT E_FAIL with Microsoft LightSwitch Visual Studio 2012 RC

守給你的承諾、 提交于 2019-12-06 11:18:46

问题


I installed Visual Studio 2012 RC recently along with VS 2012 SDK and LightSwitch Extensibility Toolkit.

this is the XAML code in my Client.Design -> TControl.XAML file

<UserControl x:Class="CustomControls.Presentation.Controls.TControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:framework="clr-namespace:Microsoft.LightSwitch.Presentation.Framework;assembly=Microsoft.LightSwitch.Client">   
    <Grid Width="Auto">
        <Grid.RowDefinitions>
            <RowDefinition Height="100"></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
        </Grid.RowDefinitions>
        <framework:ContentItemPresenter ContentItem="{Binding ChildItems[0]}" Grid.Row="0" Margin="3" />
        <framework:ContentItemPresenter ContentItem="{Binding ChildItems[1]}" Grid.Row="0" Margin="3" />
    </Grid>
</UserControl>

I cannot see the output of this XAML on the designer. Instead I see this error Message up on the designer area :

Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
Stacktrace: 
    at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
    at MS.Internal.XcpImports.Collection_InsertValue[T](PresentationFrameworkCollection`1 collection, UInt32 index, CValue value)
    at MS.Internal.XcpImports.Collection_InsertDependencyObject[T](PresentationFrameworkCollection`1 collection, UInt32 index, DependencyObject value)
    at System.Windows.PresentationFrameworkCollection`1.InsertDependencyObject(Int32 index, DependencyObject value)
    at System.Windows.Controls.UIElementCollection.InsertInternal(Int32 index, UIElement value)

I strongly suspect this is has something to do with namespaces involved here and the Silverlight version. My project is set to use Silverlight version 5.

A quick googling and 'Stackoverflowing" did reveal some general info about this error but nothing of much help.

Any help will be greatly appreciated.


回答1:


To fix this in VS2013 ultimate I had to follow the post http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html

Wherein it talks about simply cleaning out Visual Studio's ItemTemplateCache and running vs with the /setup flag one time.

In case the link breaks or is otherwise unavailable here's where the cache used to be for older VS:

You can delete the project cache at "Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache", then run "devenv /setup" to build the cache again to see if it helps.




回答2:


You've been explicit about which versions of LS RC & the 2012 SDK you've installedc, but what version of the extensibility kit did you install? I know one was released for the Beta, I'm not sure if another one was issued specifically for LS V2 RC.



来源:https://stackoverflow.com/questions/11016025/exception-error-hresult-e-fail-with-microsoft-lightswitch-visual-studio-2012-rc

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