在共享 (.shproj) 项目中添加引用 [英] Adding references in a shared (.shproj) project

查看:46
本文介绍了在共享 (.shproj) 项目中添加引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在向共享项目添加 dll 引用时遇到问题.如下图所示,我有一个通用解决方案,其中包含一个 Windows 项目和一个 Windows Phone 项目.

I'm having an issue with adding a dll reference to a shared project. As seen in the picture below I have a Universal solution with a project for windows and a project for windows phone.

在 HubApp1.Shared 项目中,我需要为 Class.cs 中的一些代码添加引用.我将在 Windows 项目和 Windows Phone 项目中使用 Class.cs.我已经在 Bing 上搜索了如何解决这个问题,但找不到任何东西.

In the HubApp1.Shared project I need to add a reference for some code in Class.cs. I will be using Class.cs in both the Windows project and the Windows Phone project. I have scoured Bing for how to fix this and I couldn't find anything.

推荐答案

您必须在 WP 和 Windows 项目中添加引用.

You must add the reference in both WP and Windows project.

原因是共享项目没有编译成任何输出 DLL - 它被编译引用它的项目,所以它不能引用除其他共享项目之外的任何其他项目类型.

The reason for this is that shared project is not compiled into any output DLL - it is compiled into the project that references it, so it cannot reference any other project types except other Shared Projects.

这篇关于在共享 (.shproj) 项目中添加引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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