简体   繁体   English

创建新的SL4导航应用时出现编译错误

[英]compile error when creating a new SL4 navigation app

I created a new Silverlight Navigation Application using Visual Studio 2010. I didn't make any changes to the code. 我使用Visual Studio 2010创建了一个新的Silverlight导航应用程序。我没有对代码进行任何更改。 Just Pressed F5 to run. 只需按F5键即可运行。 I get the following error message: 我收到以下错误消息:

The type 'System.Windows.Navigation.NavigationEventArgs' exists in both 'c:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\Silverlight\\v4.0\\System.Windows.Controls.Navigation.dll' and 'c:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\Silverlight\\v4.0\\System.Windows.dll' 'c:\\ Program Files(x86)\\ Reference Assemblies \\ Microsoft \\ Framework \\ Silverlight \\ v4.0 \\ System.Windows.Controls.Navigation.dll'和'c中都存在类型'System.Windows.Navigation.NavigationEventArgs' :\\ Program Files(x86)\\ Reference Assemblys \\ Microsoft \\ Framework \\ Silverlight \\ v4.0 \\ System.Windows.dll'

I right clicked the Silverlight Navigation Application folder in the solution explorer and changed its "Target Silverlight Version" from Silverlight 4 to Silverlight 3 and then ran the application (by pressing F5) and it works fine. 我右键单击解决方案资源管理器中的Silverlight导航应用程序文件夹,并将其“目标Silverlight版本”从Silverlight 4更改为Silverlight 3,然后运行该应用程序(按F5键),效果很好。

I've already spent a lot of time trying to fine a solution. 我已经花了很多时间来完善解决方案。 I want to develop application using Silverlight 4. 我想使用Silverlight 4开发应用程序。

Would really appreciate any help with this. 非常感谢您的帮助。

Regards, Vivek 问候,Vivek

It sounds like you have Silverlight 4's runtime, but an older set of VS tools or an older SDK, or your project is somehow referencing the older SDK. 听起来您具有Silverlight 4的运行时,但是使用了一套较旧的VS工具或一个较旧的SDK,或者您的项目以某种方式引用了较旧的SDK。

Basically, that type moved from the System.Windows.Controls.Navigation DLL (where it was in SL3) to System.Windows.dll (where it is in SL4). 基本上,该类型从System.Windows.Controls.Navigation DLL(在SL3中)移动到System.Windows.dll(在SL4中)。 CLR type-forwarding should take care of this. CLR类型转发应注意这一点。

Since Silverlight version numbers on assemblies didn't change between SL3 and SL4 it can be somewhat hard to tell if you're in the situation where you have outdated tools/SDK. 由于程序集上的Silverlight版本号在SL3和SL4之间没有变化,因此很难判断您是否处在工具/ SDK过时的情况。 Check the last modified date on System.Windows.Controls.Navigation.dll and see if it looks like about the time SL4 was released, or check if the Frame control has a property called ContentLoader - if so, you have the updated bits (and my answer is thus not helping). 检查System.Windows.Controls.Navigation.dll的上次修改日期,看是否看起来像SL4的发布时间,或者检查Frame控件是否具有一个名为ContentLoader的属性-如果是这样,则您具有更新的位(和因此,我的回答无济于事。 If not, however, then try reinstalling the SL4 Tools and/or SDK and check that your project is referencing the v4 Navigation assembly. 但是,如果没有,请尝试重新安装SL4工具和/或SDK,并检查您的项目是否引用了v4导航程序集。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM