vs2015 可移植类库_带有.NET的跨平台可移植类库正在发生

vs2015 可移植类库

vs2015 可移植类库

image

Portable Class Libraries are the Happy Little Feature that Could. They've been chugging along, doing their thing, and it's getting to the point where they are going to pop. That's pop in a good way.

便携式类库是可以满足的快乐小功能。 他们一直在努力奋斗,做自己的事,并且到了他们要流行的地步。 流行乐很好。

If you're not writing .NET apps for more than one target, then you likely haven't bumped into them. However for those people who are writing .NET and want it to run on everything from Watches to Phones to Tablets to Xboxen to Desktops to the Cloud, they are enjoying what PCLs can offer.

如果您不打算为多个目标编写.NET应用程序,那么您可能还没有碰到它们。 但是,对于那些正在编写.NET并希望使其在从手表到手机到平板电脑,从Xboxen到台式机再到云的一切事物上运行的人们,他们喜欢PCL所提供的功能。

There's still a few technical and legal challenges but I'm confident they'll be dealt with and we'll be able to create great binary libraries that can be used everywhere.

仍然存在一些技术和法律挑战,但我相信它们会得到解决,我们将能够创建可在任何地方使用的出色的二进制库。

There's been a bunch of recent activity in the .NET community around Portable Class Libraries and cross platform .NET.  Overall, Portable Class Libraries are starting to see wider adoption, more open source libraries are being released with portable support, and the MVVM pattern is proving to be a great way to maximize code sharing in cross platform apps.

.NET社区中有大量有关便携式类库和跨平台.NET的活动。 总体而言,可移植类库开始得到更广泛的采用,在可移植支持下发布了更多的开放源代码库,并且MVVM模式被证明是最大化跨平台应用程序中代码共享的好方法。

便携式库发行 (Portable Library Releases)

First of all, there have been a bunch of new libraries released as PCLs recently.  Three of them are from GitHub's own Paul Betts:

首先,最近有许多新库作为PCL发布。 其中三个来自GitHub自己的Paul Betts

  • Reactive UI – Reactive UI is an MVVM framework built on top of the Reactive ExtensionsVersion 5.0 was released last week, which is "totally Portable-Friendly", and supports the following platforms:

    响应式用户界面–响应式用户界面是基于响应式扩展构建的MVVM框架。 5.0版本于上周发布,“完全可移植”,并支持以下平台:

    • Xamarin.iOS

      Xamarin.iOS
    • Xamarin.Android

      Xamarin.Android
    • Xamarin.Mac

      Xamarin.Mac
    • .NET 4.5 (WPF)

      .NET 4.5(WPF)
    • Windows Phone 8

      Windows Phone 8
    • Windows Store Apps (WinRT)

      Windows应用商店应用(WinRT)

    Reactive UI – Reactive UI is an MVVM framework built on top of the Reactive ExtensionsVersion 5.0 was released last week, which is "totally Portable-Friendly", and supports the following platforms:

    响应式用户界面–响应式用户界面是基于响应式扩展构建的MVVM框架。 5.0版本已于上周发布,“完全可移植”,并支持以下平台:

  • Akavache - An asynchronous, persistent key-value store.  Version 3.0, which includes PCL support, was also released last week, and now "nearly all of your serialization and network access layer can be cross-platform." Akavache supports the same set of platforms as Reactive UI. This is a really amazing piece of software that deserves its own blog post. I'll do one soon.

    Akavache-一个异步的,持久的键值存储。 上周还发布了包含PCL支持的3.0版,现在“几乎所有的序列化和网络访问层都可以跨平台。” Akavache支持与Reactive UI相同的平台集。 这是一款非常了不起的软件,值得拥有自己的博客文章。 我会尽快做的。

  • Splat – "A library to make things cross-platform that should be." It has cross platform APIs for images and colors, with platform-specific extension methods to go back and forth between the platform-specific native types.  This looks like an elegant solution to the problem you run into if you want a portable ViewModel but you want to expose an image in it.

    Splat –“使事物应该跨平台的库。” 它具有用于图像和颜色的跨平台API,并且具有特定于平台的扩展方法,可以在特定于平台的本机类型之间来回切换。 如果您想要一个可移植的ViewModel但要在其中公开图像,这看起来像是一种解决问题的绝妙解决方案。

Next, Scott LoveGrove confessed:

接下来, Scott LoveGrove承认:

I might be getting a little obsessed with PCLs at the moment. #IHaveAProblem (link).

目前,我可能对PCL有点痴迷。 #IHaveAProblem(链接)。

Scott has released four portable libraries that help access web services:

Scott发布了四个可移植的库,可帮助访问Web服务:

  • Scoreoid Portable - A Portable Class Library that gives developers access to the Scoreoid scoring system.  The library provides a friendly .NET wrapper for the Scoreoid REST APIs, and uses our portable HttpClient NuGet package.

    Scoreoid Portable-一种便携式类库,使开发人员可以访问Scoreoid评分系统。 该库为Scoreoid REST API提供了友好的.NET包装,并使用了我们的可移植HttpClient NuGet包。

  • FanArt Portable - A Portable Class Library that gives developers access to the fanart.tv film, TV, and music image resources.  It also uses portable HttpClient.

    FanArt Portable-一个便携式类库,使开发人员可以访问fanart.tv电影,电视和音乐图像资源。 它还使用可移植的HttpClient。

  • Cineworld Portable - A Portable Class Library that gives developers access to the Cineworld film and cinema listings for the UK and Ireland.  It also uses portable HttpClient.

    Cineworld Portable-一个便携式类库,使开发人员可以访问英国和爱尔兰的Cineworld电影和电影列表。 它还使用可移植的HttpClient。

  • LiveSDKHelper - A helper library to more easily use the Microsoft Live SDK.  Contains strong types which the responses from the Live SDK can be deserialized into.

    LiveSDKHelper-帮助程序库,可以更轻松地使用Microsoft Live SDK。 包含强类型,可以将Live SDK的响应反序列化为强类型。

Another new portable library release is Budgie, a library for accessing Twitter. The .NET and Azure Teams have also released a PILE of Portable Libraries.

另一个新的可移植库版本是Budgie ,一个用于访问Twitter的库。 .NET和Azure团队还发布了PILE便携式库。

.NET Team:

.NET团队:

Other teams:

其他队伍:

Not to mention all these excellent Portable Libraries that you should be familiar with as well.

更不用说您也应该熟悉的所有这些优秀的便携式库。

MVVM

MVVM

IoC

IoC

Other

其他

and of course, my favorite, the HttpClient, making HTTP calls easier, since, well, since a few months ago.

当然,我最喜欢的HttpClient使得自几个月前以来的HTTP调用变得更加容易。

public static async Task<HttpResponseMessage> GetTheGoodStuff() 
{
var httpClient = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://hanselman.com/blog/");
var response = await httpClient.SendAsync(request);
return response;
}

//建立/ (//build/)

One BUILD attendee took issue with the fact that speakers were telling people that you can't use platform specific functionality from a Portable Class Library, and wrote a blog post about how you can do this with abstraction and (preferably) dependency injection.

一位BUILD与会者对以下事实提出了质疑:演讲者告诉人们您不能使用可移植类库中的平台特定功能,并写了一篇博客文章,介绍如何通过抽象和(最好是)依赖项注入来实现此目的。

On at least 2 occasions recently, I have heard speakers tell their audience that you cannot reference a target-specific .NET library (such as a .NET Framework 4.5 library) from a Portable Class Library. While this is technically true, it doesn't tell nearly the whole story. Even though we can't reference target-specific libraries, we can still USE these libraries. We can call their methods and access their properties under the right circumstances. We can gain access to these libraries via an abstraction. My preferred method of doing this is...Dependency Injection.

最近,至少有2次,我听到有发言者告诉他们的听众,您不能从可移植类库中引用目标特定的.NET库(例如.NET Framework 4.5库)。 尽管从技术上讲这是正确的,但它并不能说明全部情况。 即使我们无法引用特定于目标的库,我们仍然可以使用这些库。 我们可以在适当的情况下调用它们的方法并访问它们的属性。 我们可以通过抽象来访问这些库。 我这样做的首选方法是...依赖注入。

跨平台.NET凉爽 (Cross Platform .NET Coolness)

There's lots of great examples of code reuse, like the podcast I did with the folks who wrote "Draw a Stickman EPIC." This app has 95%+ code reuse, all written in C# and is available in every App Store there is. Here's a few others.

有很多很好的代码重用示例,例如我与写“绘制Stickman EPIC”的人们进行的播客。 此应用程序具有95%以上的代码重用率,全部用C#编写,并且在每个App Store中都可用。 这里还有其他一些。

Also, be sure to check out my talk from the Xamarin Evolve Conference - How C# Saved My Marriage. I talk about Portable Libraries in this talk. We'll hear more about Portable Libraries at the MonkeySpace Conference in Chicago in July of 2013.

另外,请务必查看Xamarin Evolve Conference上的演讲-C#如何保存我的婚姻。 我在本次演讲中谈论便携式图书馆。 在2013年7月于芝加哥举行的MonkeySpace会议上,我们将听到有关便携式图书馆的更多信息。

The British and Irish Lions app is a cross platform app targeting Windows Store, Windows Phone, iOS and Android. It uses Portable Class Libraries to share common code across platforms, Azure to host the services it uses, and the MvvmCross MVVM framework which I'm a huge fan of. The UK MSDN blog posted a case study of the development of the app, and there is also a prettier case study (with screenshots, infographics, etc) and a blog post by the developers.  In reference to Xamarin, MvvmCross, and Portable Class libraries, they state "Given the very short time-scales for the Lions apps (less than three months from the first line of code to our first release), we simply could not have delivered a rich native experience across all platforms without the common core."

British and Irish Lions应用程序针对Windows Store,Windows Phone,iOS和Android的跨平台应用程序。 它使用可移植类库在各个平台之间共享通用代码,使用Azure托管其使用的服务以及我非常喜欢的MvvmCross MVVM框架。 英国MSDN博客发布了有关该应用程序开发的案例研究,此外,还有更漂亮的案例研究(包括屏幕截图,信息图表等)以及开发人员的博客文章。 关于Xamarin,MvvmCross和Portable Class库,他们说:“鉴于Lions应用的时间范围很短(从第一行代码到我们的第一个版本,不到三个月),我们根本无法交付无需通用内核即可在所有平台上拥有丰富的本地经验。”

Lions Rugby

Another cross platform app that uses MvvmCross is Aviva Drive.  This is an insurance company app that you can use to track your driving habits and hopefully get a discount on your insurance.  The app was featured in the Tech Ed Europe day 1 keynote (about 28:40 in), focusing on how it used Azure.

使用MvvmCross的另一个跨平台应用程序是Aviva Drive 。 这是一个保险公司的应用程序,您可以使用它来跟踪自己的驾驶习惯,并希望获得保险折扣。 该应用程序在Tech Ed Europe第1天主题演讲(约28:40英寸)中进行了介绍,重点介绍了如何使用Azure。

On the game side of things, Taptitude is a successful Windows Phone 7 game (or rather, a collection of minigames) which was ported to Windows Phone 8, Windows Store, iOS, and Android with the help of MonoGame and Xamarin.  The team reports that they have more than 99% shared code between all the platforms, which is especially important to them because they ship updates to the game about every week.

在游戏方面, Taptitude是一款成功的Windows Phone 7游戏(或更确切地说是小游戏的集合),它MonoGame和Xamarin的帮助下已移植到Windows Phone 8,Windows Store,iOS和Android。 该团队报告说,他们在所有平台之间拥有超过99%的共享代码,这对他们来说尤其重要,因为他们大约每周都会向游戏发布更新。

Xamarin (Xamarin)

Xamarin has released an amazing .NET Mobility Scanner which analyzes code and tells you how "portable" it is and how compatible it will be with Xamarin.Android, Xamarin.iOS, Windows Phone, and Windows Store.  It lists all the APIs your code uses that aren't available on all the platforms, and an overall percentage of how portable your code is.  It's a very slick implementation and similar to what we've wanted to have for Portable Class Libraries.  Here's a sample report for the SignalR client library. The best part is that it does all this analysis without sending your code or binaries to Xamarin. It all happens in the browser. I love Xamarin.

Xamarin发布了一个了不起的.NET Mobility Scanner 它将分析代码,并告诉您它的“便携性”以及与Xamarin.Android,Xamarin.iOS,Windows Phone和Windows Store的兼容性。 它列出了代码在所有平台上均不可用的所有API,以及代码可移植性的总体百分比。 这是一个非常巧妙的实现,类似于我们希望为可移植类库提供的实现。 这是SignalR客户端库的示例报告最好的部分是,它无需将您的代码或二进制文件发送到Xamarin即可完成所有这些分析。 这一切都发生在浏览器中。 我爱Xamarin。

Phil Haack (former PM for ASP.NET MVC and now working at GitHub) wrote a blog post titled Platform Limitations Harm .NET.  He argues that the Windows platform limitations should be removed from the EULAs for BCL NuGet packages.

Phil Haack( ASP.NET MVC的前PM,现在在GitHub上工作)写了一篇博客文章,标题为Platform Limitations Harm.NET 。 他认为Windows平台限制应从BCL NuGet软件包的EULA中删除。

I personally agree. Being able to reuse existing code, make portable libraries, and write apps that run in 64k or 64gigs is what makes .NET an interesting platform.

我个人同意。 能够重用现有代码,制作可移植库以及编写以64k或64gigs运行的应用程序,是使.NET成为有趣的平台的原因。

翻译自: https://www.hanselman.com/blog/crossplatform-portable-class-libraries-with-net-are-happening

vs2015 可移植类库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值