VS2010:关于从 .NET 项目添加对 Silverlight 项目的项目引用的警告 [英] VS2010: Warning on add project reference to Silverlight project from .NET project

查看:26
本文介绍了VS2010:关于从 .NET 项目添加对 Silverlight 项目的项目引用的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 VS2010、Silverlight 4、.NET 4 中,我有一个 WCF 服务和一个 Silverlight 应用程序,并且 Silverlight 不是通过添加服务引用而是通过共享合同来访问该类.自然,这意味着我在 Silverlight 类库中拥有合同,并且该服务具有对该库的项目引用.

In VS2010, Silverlight 4, .NET 4, I've got a WCF service and a Silverlight app, and Silverlight is accessing the class not with Add Service Reference but by sharing the contract. Naturally, this means I have the contract in a Silverlight class library, and the service has a project reference to that library.

奇怪的是,这会导致引用上出现/! 图标和警告:

Strangely, this results in a /! icon on the reference, and a warning:

无法引用项目SilverlightClassLibrary1".引用的项目针对不同的框架系列 (Silverlight)

但是,参考工作正常(我可以在我的 Silverlight 应用程序中使用该界面)并且构建正常.

However, the reference works fine (I can use the interface in my Silverlight app) and builds fine.

这是一个错误吗?我的猜测是肯定的,因为如果您添加程序集引用而不是项目引用,警告是在说谎并且也会消失.我提交了一个 错误 还有更多信息 此处 也是如此.

Is this a bug? My guess is yes, since the warning is lying and also goes away if you add an assembly reference instead of a project reference. I filed a bug and there's more info here as well.

推荐答案

微软回应bug 我发布了.该警告旨在存在并且旨在成为警告而不是错误,尽管我认为文本很糟糕.原因是引用 Silverlight 项目将导致运行时失败如果 Silverlight 没有正确安装在机器上.目前没有办法抑制警告.

Microsoft responded to the bug I posted. The warning is intended to exist and intended to be a warning and not an error, although I would argue that the text is bad. The reason is that referencing a Silverlight project will result in runtime failures if Silverlight isn't installed properly on the machine. There is currently no way to suppress the warning.

这篇关于VS2010:关于从 .NET 项目添加对 Silverlight 项目的项目引用的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆