我遇到一个问题,我在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>
其中一些具有已复制到Debug目录的程序集的本地路径。它们肯定存在,以及具有相同名称的.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设计器和智能感知。
答案 0 :(得分:2)
我上面的评论abount创建一个新项目并重新加载原始项目似乎工作正常。