编译Silverlight运行时问题

发布于 2024-07-17 21:41:27 字数 1199 浏览 3 评论 0原文

我创建了一个 Silverlight 项目,其中还包含一个 Web 项目。

我的 Web 项目中有一些使用 System.Windows.Point 和 System.Windows.Size 数据类型的类文件,当我尝试在 List之类的列表中传递这些类型中的任何一个时,我收到编译错误; 在 Silverlight 项目中。 如果我尝试不使用 List<>,我仍然会收到 Point 数据类型错误。

我查看了 David Betz 中有关编译 Silverlight 程序集的信息网站我找到了一个工具来帮助我使用他的两种方法中的第一种讨论并成功编译了运行时并在我的 Silverlight 项目中引用了它。

以下是错误:

  • “System.Windows.Point”类型是 在程序集中定义的不是 参考。 您必须添加参考 组装'WindowsBase, 版本=3.0.0.0,文化=中立, PublicKeyToken=31bf3856ad364e35'。 C:\文档 和设置\加里\我的文档\视觉 工作室 2008\Projects\GEP.Reports.Spatial\GEP.Reports.Spatial\MainPage.xaml.cs
  • 无法从 'System.Collections.Generic.List [c:\程序文件\参考 程序集\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll]' 到 'System.Collections.Generic.List [c:\程序文件\参考 Assemblies\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll]

为了将这些类型添加到我的 Silverlight 运行时中,我缺少什么步骤。

谢谢你的帮助。

加里

I have created a Silverlight project which also contains a Web project.

I have a few class files in my web project which use System.Windows.Point and System.Windows.Size data types and I am getting compile errors when I try to pass either of these types in a List like List<Point> in the Silverlight project. If I try without the List<> I still get the Point data type error.

I reviewed information about compiling Silverlight assemblies from David Betz site I found a tool to help me used the first of the two approaches he discusses and have successfully compiled the runtime and referenced it in my Silverlight project.

Here are the errors:

  • The type 'System.Windows.Point' is
    defined in an assembly that is not
    referenced. You must add a reference
    to assembly 'WindowsBase,
    Version=3.0.0.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35'. C:\Documents
    and Settings\Gary\My Documents\Visual
    Studio
    2008\Projects\GEP.Reports.Spatial\GEP.Reports.Spatial\MainPage.xaml.cs
  • cannot convert from
    'System.Collections.Generic.List
    [c:\Program Files\Reference
    Assemblies\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll]'
    to
    'System.Collections.Generic.List
    [c:\Program Files\Reference
    Assemblies\Microsoft\Framework\Silverlight\v3.0\mscorlib.dll]

What step am I missing in order to get these types added to my Silverlight runtime.

Thanks for any help.

Gary

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

丶情人眼里出诗心の 2024-07-24 21:41:27

对于像 Point 和 Size 这样的简单类型,您最好滚动自己的结构/类,而不是尝试找到引用非 Silverlight 程序集的方法。 此外,您并不真正希望为了诸如 Point 结构之类的内容而将 System.Windows 程序集之类的内容包含在 .xap 中。

For simple types like Point and Size you are better off rolling your own structs/classes rather than trying to find ways of referencing non-Silverlight assemblies. In addition you don't really want something like the System.Windows assembly being included in your .xap for the sake of something like the Point struct.

雪落纷纷 2024-07-24 21:41:27

实际上你可以使用System.Windows.Point。 只需在您的 WS 中使用 SL dll:

C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll

actually you can use System.Windows.Point. Just in your WS use SL dll:

C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文