构建跨平台库 - 在2015年VS类库 [英] Class libraries in VS 2015 - Building Cross Platform Libraries

查看:265
本文介绍了构建跨平台库 - 在2015年VS类库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有我可以在VS 2015创建Xamarin安装不同的类库:

There are different class libraries I can create in VS 2015 with Xamarin installed:


  1. 类库

  2. 类库(Android版)

  3. 类库(包)

  4. 类库(便携式通用应用程序)

  5. 类库(便携式)

  6. 类库(Xamarin.Forms)

  1. Class Library
  2. Class Library (Android)
  3. Class Library (Package)
  4. Class Library (Portable for Universal Apps)
  5. Class Library (Portable)
  6. Class Library (Xamarin.Forms)

我很想知道每个之间的区别 - 只是一个短暂的会做:)

I would love to know the difference between each - just a brief would do :)

场景

我们的团队目前正在开发我们正在为多个平台瞄准一个新的项目 - 网络和移动(Xamarin)为主。当我们决定把重点放在了MVC的Web应用程序首先,我们要创建一个项目来包含所有模型和业务类(逻辑),以便它可以在我们以后的项目上使用。这类库将是最合适的?

Our team is currently developing a new project which we are targeting for multiple platforms - web and mobile (Xamarin) primarily. While we decided to focus on the MVC web app first, we want to create a single project to contain all models and business classes (logic) so that it can be used across our projects later on. Which class library would be the most appropriate?

推荐答案

这问题有一个相当大的范围内,我会尽力回答,尽我可以:

This question has a pretty large scope, I'll try answer as best I can:

一个标准的.NET类库,它输出的DLL。此项目类型只能在台式机平台(在Mac,Windows)中使用。这些项目类型无法通过Android和iOS项目引用。

A standard .NET class library which outputs a DLL. This project type can only be used on Desktop platforms (Mac, Windows). These project types cannot be referenced by Android and IOS projects.

这是Android的具体类库类同一个正常的Android库。该项目旨在分享的Android特有的资源,如活动,片段,视图,图形,字符串等这个项目只能通过Android应用程序项目或其他Android库项目引用。

An Android specific class library similiar to a normal Android library. This project is designed to share Android-specific resources such as activities, fragments, views, drawables, strings etc. This project can only be referenced by Android App projects or other Android library projects.

我们已经把通常我们主要的Android应用到库,然后做了一个启动画面只有Android应用程序,链接库项目。这让我们每个屏幕隔离到一个单独的试验平台应用独立测试每一个画面,而无需通过整个应用程序,以测试它们。

We've typically put our main Android app into a library then done a splash screen only Android Application that links the library project. This is so we can isolate each screen into a seperate "Testbed" application to test each screen independently without needing to go through the entire app to test them.

这类型不在我的VS安装,所以我不能在它是什么意见。

This type isn't in my VS install so I can't comment on what it is.

一个可移植类库为目标.NET 4.5包括Windows 8中,Xamarin.Android,Xamarin.iOS和Xamarin支持。 iOS版(经典)。这是 TargetFrameworkProfile Profile7

A Portable Class Library that targets .NET 4.5 including support for Windows 8, Xamarin.Android, Xamarin.iOS and Xamarin.iOS (classic). This is TargetFrameworkProfile Profile7.

一个可移植类库,对Windows 8面向.NET 4.5的支持,Windows Phone的8.1的Windows Phone 8的Silverlight,Xamarin.Android,Xamarin.iOS和Xamarin.iOS(经典)。这是 TargetFrameworkProfile Profile259

A Portable Class Library that targets .NET 4.5 with support for Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8, Xamarin.Android, Xamarin.iOS and Xamarin.iOS (classic). This is TargetFrameworkProfile Profile259.

一个可移植类库,对Windows 8面向.NET 4.5的支持,Windows Phone的8.1的Windows Phone 8的Silverlight,Xamarin.Android,Xamarin.iOS(经典),Xamarin.iOS统一和Xamarin.Mac统一。这是 TargetFrameworkProfile Profile78

A Portable Class Library that targets .NET 4.5 with support for Windows 8, Windows Phone 8.1, Windows Phone Silverlight 8, Xamarin.Android, Xamarin.iOS (classic), Xamarin.iOS Unified and Xamarin.Mac Unified. This is TargetFrameworkProfile Profile78.

请注意,该库的便携式通用应用,< STRONG> Xamarin.Forms 和便携式是相同的项目类型(一PCL库),除了 Xamarin.Forms 包括平台数量最多的支持。

Note that the libraries Portable for Universal Apps, Xamarin.Forms and Portable are identical project types (a PCL library) except Xamarin.Forms includes support for the greatest number of platforms.

在项目结构来看,我们对平台(Android,IOS,Windows)中的一个项目,它引用了PCL (定义我们的接口和DB实体)并实现大部分应用程序逻辑的共享项目。

In terms of project structure, we have a project for each platform (Android, iOs, Windows) that references a PCL (that defines our interfaces and DB entities) and a shared project that implements the majority of the application logic.

我建议您阅读以下链接和使用的Tasky 源代码为您的应用程序的基础:

I suggest reading the following links and using the Tasky source code as a basis for your application:

  • Building Cross Platform Applications
  • Shared Projects

这篇关于构建跨平台库 - 在2015年VS类库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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