Windows Phone 和 Android App 项目的通用库 [英] Common library for Windows Phone and Android App projects

查看:30
本文介绍了Windows Phone 和 Android App 项目的通用库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Windows 手机应用程序和一个 Android 应用程序.这两个应用程序都在一个 Visual Studio 2010 解决方案下.

I am developing a windows phone app and an android app. Both the apps are under one visual studio 2010 solution.

我想在同一个解决方案下包含第三个项目,其中包含 windows 和 android 应用程序都使用的通用功能.因此,为此,当我使用普通的类库"并尝试在 Windows Phone 应用程序项目中引用它时,它会显示无法添加选定的项目引用.项目引用必须是另一个相同的 Silverlight for Windows Phone 项目或更低版本".

I wanted to include a third project under the same solution which contains common functionality that both windows and android app uses. So, for this when I use plain 'Class Library' and when I try to reference that in windows phone app project, it says "Unable to add the selected project reference. The project reference must be another Silverlight for Windows Phone project that is same or lower version".

您建议使用哪种类型的项目,以便我可以在 windows phone 和 android 项目中使用它?

Which type of project do you suggest, so that I can use it windows phone and android projects?

推荐答案

您将不得不使用两个不同的 csproj 文件 - 因为这两个平台的构建目标和其他部分将不同.在每个 csproj 中使用 this 递归包含从公共位置添加源.

You will have to use two different csproj files - because the build targets and other pieces will be different for the two platforms. Use this recursive include in each csproj to add the sources from a common location.

您也可以尝试使用便携式类库 扩展,但我不确定它是否会有所帮助.

You can also try to use the Portable class library extension but I'm not sure if it will help.

这篇关于Windows Phone 和 Android App 项目的通用库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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