Xamarin Forms .NETStandard 1.4 资源问题 [英] Xamarin Forms .NETStandard 1.4 resources issue

查看:26
本文介绍了Xamarin Forms .NETStandard 1.4 资源问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的 PCL 项目从经典的 Xamarin Forms 转换为 .NETStandard 1.4我有资源问题(*.resx)

I've had converted my PCL project from classic Xamarin Forms to .NETStandard 1.4 and I have a issue with resources(*.resx)

错误 CS0103 名称资源"在当前不存在上下文 Prog1Utilities D:\MyProjects\Pro1\Pro1Utilities\WebUtilities\ApiService.cs 38 Active

Error CS0103 The name 'Resource' does not exist in the current context Prog1Utilities D:\MyProjects\Pro1\Pro1Utilities\WebUtilities\ApiService.cs 38 Active

我该如何解决?

项目.json

{
  "supports": {},
  "dependencies": {
    "Newtonsoft.Json": "9.0.1",
    "System.Net.Http": "4.3.0",
    "Xam.Plugin.Connectivity": "2.2.12",
    "Xamarin.Forms": "2.3.3.168"
  },
  "frameworks": {
    "netstandard1.4": {
      "imports": "portable-win+net45+wp8+win81+wpa8"
    }
  }
}

推荐答案

要使 .resx 工作,您需要添加 Microsoft.NETCore.Portable.Compatibility NuGet 包.但是,此后的构建还有其他问题.这已经是一个众所周知的问题,微软的人正在解决这个问题.一旦我收到他们的任何更新,我会更新这篇文章.

To make .resx work, you need to add Microsoft.NETCore.Portable.Compatibility NuGet package. However, there are other problems with building after that. This is a well-known problem already and folks in Microsoft work on it. I'll update this post once I have any updates from them.

更新(2016 年 12 月)

截至目前,根据 Microsoft 支持,Xamarin 与 .NET Standard 不完全兼容.如果有人证明我错了,我会很高兴.

As of now, Xamarin is not fully compatible with .NET Standard according to Microsoft support. I'll be happy if someone prove me wrong.

更新(2017 年 3 月)

这个问题似乎在 Visual Studio 2017 中消失了.

The problem seems to be gone in Visual Studio 2017.

这篇关于Xamarin Forms .NETStandard 1.4 资源问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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