【问题标题】:Exception: Error HRESULT E_FAIL with Microsoft LightSwitch Visual Studio 2012 RC异常:Microsoft LightSwitch Visual Studio 2012 RC 出现错误 HRESULT E_FAIL
【发布时间】:2012-06-13 13:35:57
【问题描述】:

我最近安装了 Visual Studio 2012 RC 以及 VS 2012 SDK 和 LightSwitch Extensibility Toolkit。

这是我的 Client.Design -> TControl.XAML 文件中的 XAML 代码

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

我在设计器上看不到此 XAML 的输出。相反,我在设计器区域看到此错误消息:

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)

我强烈怀疑这与此处涉及的命名空间和 Silverlight 版本有关。我的项目设置为使用 Silverlight 版本 5。

快速谷歌搜索和“Stackoverflowing”确实揭示了有关此错误的一些一般信息,但没有太大帮助。

任何帮助将不胜感激。

【问题讨论】:

    标签: silverlight visual-studio-lightswitch visual-studio-2012 hresult


    【解决方案1】:

    要在 VS2013 终极版中解决此问题,我必须关注帖子 http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html

    其中谈到了简单地清理 Visual Studio 的 ItemTemplateCache 并使用 /setup 标志运行 vs 一次。

    如果链接断开或不可用,这里是旧 VS 的缓存位置:

    您可以在“Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache”,然后运行“devenv /setup" 再次构建缓存,看看是否有帮助。

    【讨论】:

      【解决方案2】:

      您已经明确说明了您安装了哪些版本的 LS RC 和 2012 SDK,但您安装了哪个版本的扩展工具包?我知道一个是为 Beta 发布的,我不确定另一个是不是专门为 LS V2 RC 发布的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-09-21
        • 2022-10-13
        • 2018-08-03
        • 2021-06-05
        • 1970-01-01
        • 2015-08-03
        相关资源
        最近更新 更多