VS2010:从 .NET 项目添加对 Silverlight 项目的项目引用时发出警告
在 VS2010、Silverlight 4、.NET 4 中,我有一个 WCF 服务和一个 Silverlight 应用程序,并且 Silverlight 不是通过添加服务引用而是通过共享契约来访问该类。当然,这意味着我在 Silverlight 类库中拥有合约,并且该服务具有对该库的项目引用。
奇怪的是,这会导致引用上出现 /!\ 图标,并出现警告:
无法引用项目“SilverlightClassLibrary1”。引用的项目针对不同的框架系列(Silverlight)
但是,引用工作正常(我可以在我的 Silverlight 应用程序中使用该界面)并且构建良好。
这是一个错误吗?我的猜测是肯定的,因为警告是谎言,并且如果您添加程序集引用而不是项目引用,警告也会消失。我提交了 bug 并且有更多信息
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:
The project 'SilverlightClassLibrary1' cannot be referenced. The referenced project is targeted to a different framework family (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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Microsoft 回复了 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.
如果您希望警告消失,可以使用“添加引用”-->“浏览”直接添加 dll,而不是通过“添加引用”-->“项目”添加项目。
这对我们来说也是一个非常烦人的问题,这是我们发现唯一有效的解决方法。
If you want the warning to disappear you can add the dll directly by using the "Add Reference"-->"Browse" instead of adding the project via "Add Reference"-->"Projects".
This was a very annoying issue for us as well and this was the only workaround we found that worked.