visual-studio - xaml程序集引用问题

标签 visual-studio silverlight xaml

我有一个问题,我在我的 silverlight 应用程序中引用的大多数程序集似乎都没有在 xaml 中找到,尽管事实上我已经使用“添加引用”对话框添加了对项目的引用,可以看到它们存在于指定位置,并且可以使用对象浏览器浏览它们。 我正在使用 VS 2010 和 SL4, 和最新的 SL 工具包

这是 fsproj 文件中的引用...

<ItemGroup>
    <Reference Include="FSharp.PowerPack">
      <HintPath>C:\Program Files\FSharpPowerPack-2.0.0.0\Silverlight\v3.0\FSharp.PowerPack.dll</HintPath>
    </Reference>
    <Reference Include="mscorlib" />
    <Reference Include="FSharp.Core">
      <HintPath>$(ProgramFiles)\Microsoft F#\Silverlight\Libraries\Client\$(SilverlightVersion)\FSharp.Core.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Core" />
    <Reference Include="System.Net" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Windows" />
    <Reference Include="System.Windows.Browser" />
    <Reference Include="System.Windows.Controls">
      <HintPath>bin\Debug\System.Windows.Controls.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Data">
      <HintPath>bin\Debug\System.Windows.Controls.Data.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Data.Input" />
    <Reference Include="System.Windows.Controls.DataVisualization.Toolkit">
      <HintPath>bin\Debug\System.Windows.Controls.DataVisualization.Toolkit.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Input">
      <HintPath>c:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.Input.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Layout.Toolkit">
      <HintPath>bin\Debug\System.Windows.Controls.Layout.Toolkit.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Navigation">
      <HintPath>c:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.Navigation.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Toolkit">
      <HintPath>bin\Debug\System.Windows.Controls.Toolkit.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Data">
      <HintPath>bin\Debug\System.Windows.Data.dll</HintPath>
    </Reference>
    <Reference Include="System.Xml" />
  </ItemGroup>

其中一些具有已复制到调试目录的程序集的本地路径。它们肯定存在,还有同名的 .xml 文件(即 System.Windows.Controls.Navigation.dll 和 System.Windows.Controls.Navigation.xml)。无论在何处引用它们,我都会遇到同样的问题。

这是它们在 xaml 中的引用方式...

<nav:Page x:Class="Module1.MyIdeas" x:Name="MyIdeas"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
    xmlns:nav="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:winControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:y="clr-namespace:Module1" NavigationCacheMode="Enabled" >
<some content.../>
</nav:Page>

以下所有程序集均有错误:“未找到错误 1 ​​程序集‘System.Windows.Controls.X’。确认您没有缺少程序集引用。另外,确认您的项目和所有引用的程序集已被建成。”

xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"  
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
xmlns:nav="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"

问题是项目构建并运行良好,但这种行为似乎破坏了 xaml 设计器和智能感知。

最佳答案

我上面关于创建新项目和重新加载原始项目的评论似乎工作正常。

关于visual-studio - xaml程序集引用问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3559464/

相关文章:

c# - 如何设置图像上下文菜单项的图标

javascript - 在 Silverlight 中如何附加到 ScriptObject 上的事件?

c++ - LNK1201 在 Visual C++ 2003 上

silverlight - 传递更新到 ViewModel 的 DependencyProperty 是一种好习惯吗?

.net - 编程 Windows Phone 7 与普通的 .NET 编程有什么不同吗?

WCF/SSL 错误 : Failed to lookup a channel to receive an incoming message

c# - .NET 毛伊岛 : Check checkbox when clicking on label

c++ - 如何在 Visual Studio (C++) 中找到应用程序的入口点

c++ - Visual Studio 中的指针和发布版本

visual-studio - 如何使用键盘快捷键浏览智能感知建议?