类型“用户控件”不支持直接的内容

类型“用户控件”不支持直接的内容

问题描述:

我有一个Outlook 2013和2016 VSTO加载项项目,我试图描述的这里

I have an Outlook 2013 and 2016 VSTO Add-in project and am trying to add a WPF user control to a custom task pane as described here.

我的问题是,当我添加用户控件(WPF)它会产生我一个WPF控件生成的网格,可自动抛出的错误类型用户控件不支持直接的内容

The problem I have is when I add the User Control (WPF) it generates me a WPF control with a grid, but automatically throws an error of "The type 'UserControl' does not support direct content".

WPF:

<UserControl x:Class="TestNamespace.UserControl1"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         xmlns:local="clr-namespace:TestNamespace"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>

</Grid>
</UserControl>



我知道在过去,我不得不GUID来的.proj文件中的WPF项目类型添加到。得到一些东西的工作,但加入本作没有区别(实际上它甚至不会在负载按照一定的顺序)

I know in the past I have had to add the WPF project type guid to the .proj file to get some things to work, but adding this made no difference (in fact it would not even load when in a certain order).

原文:

<ProjectTypeGuids>{BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>



崩溃:

Crashes:

<ProjectTypeGuids>{BAA0C2D2-18E2-41B9-852F-F413020CAA33};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>



不会崩溃,但不修复错误:

Doesn't crash, but doesn't fix the error:

<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{BAA0C2D2-18E2-41B9-852F-F413020CAA33};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>



任何人都可以点我在正确的方向?

Can anyone point me in the right direction?

更新

我试图创建一个新的类库项目直开箱,增加了一个WPF用户控件,然后添加了引用到System.Xaml和我有同样的问题。

I tried creating a new class library project straight out of the box, added a WPF user control, then added the reference to System.Xaml and I have the same issue.

对于具有上的Visual Studio 2015年这个问题谁的人,尝试添加(如果它尚未添加)System.Xaml引用您的项目。 Visual Studio的只是失败,显示引用错误。

For anyone who having this problem on Visual Studio 2015, try to add (if it's not already added) System.Xaml reference to your project. Visual Studio simply fails to show reference error.