首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >.NET Core RC2 - NeutralResourcesLanguageAttribute

.NET Core RC2 - NeutralResourcesLanguageAttribute
EN

Stack Overflow用户
提问于 2016-06-14 17:08:56
回答 1查看 597关注 0票数 3

使用.NET Core RC2的新版本,当使用新的SDK 1.0.0-preview1-002702 (从1.0.0-rc1-update1版本迁移之后)编译项目时,它将为每个框架生成一个包含属性System.Resources.NeutralResourcesLanguageAttribute的文件dotnet-compile.assemblyinfo.cs。示例:

代码语言:javascript
复制
// <auto-generated> This file has been auto generated. </auto-generated>
[assembly:System.Reflection.AssemblyFileVersionAttribute("1.0.1.0")]
[assembly:System.Resources.NeutralResourcesLanguageAttribute("en-US")]
[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v1.0")]

我的问题是,当编译到像新的这样的框架时,我现在必须向System.Resources.ResourceManager添加一个依赖项,否则它就不会编译。

有什么办法可以防止这种情况发生吗?

这是我现在的project.json

代码语言:javascript
复制
{
  "version": "1.0.1",
  "title": "Simple Exception Handling",
  "description": "Library that helps developers to handle exceptions outside catch blocks. Typical usages are global exception handlers.",
  "authors": [ "João Simões" ],
  "language": "en-US",
  "copyright": "Copyright © 2016 João Simões",
  "packOptions": {
    "summary": "Library that helps developers to handle exceptions outside catch blocks.",
    "tags": [ "exception", "handler" ],
    "projectUrl": "https://github.com/gravity00/SimpleExceptionHandling",
    "licenseUrl": "https://raw.githubusercontent.com/gravity00/SimpleExceptionHandling/master/LICENSE",
    "iconUrl": "https://raw.githubusercontent.com/gravity00/SimpleExceptionHandling/master/SimpleExceptionHandling-Logo.png",
    "releaseNotes": "Library is now strong signed",
    "owners": [ "João Simões" ],
    "repository": {
      "type": "git",
      "url": "https://github.com/gravity00/SimpleExceptionHandling"
    }
  },
  "buildOptions": {
    "xmlDoc": true,
    "optimize": true,
    "keyFile": "SimpleExceptionHandling.snk"
  },

  "frameworks": {
    ".NETPortable,Version=v4.0,Profile=Profile328": {
      "buildOptions": {
        "define": [ "PORTABLE40" ]
      },
      "frameworkAssemblies": {
        "mscorlib": "",
        "System": "",
        "System.Core": ""
      }
    },
    "dnxcore5": {
      "dependencies": {
        "System.Runtime": "4.0.0",
        "System.Resources.ResourceManager": "4.0.0"
      }
    },
    "dotnet": {
      "dependencies": {
        "System.Runtime": "4.0.0",
        "System.Resources.ResourceManager": "4.0.0"
      }
    },
    "net20": { },
    "net35": { },
    "net40": { },
    "net45": { },
    "netcore45": {
      "dependencies": {
        "System.Runtime": "4.0.0",
        "System.Resources.ResourceManager": "4.0.0"
      }
    },
    "netstandard10": {
      "imports": [ "dnxcore50" ],
      "dependencies": {
        "System.Runtime": "4.0.0",
        "System.Resources.ResourceManager": "4.0.0"
      }
    }
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-15 21:14:07

[NeutralResourcesLanguage]属性包括在内,因为您希望通过在project.json中设置"language": "en-US"来包含它。

如果不希望依赖于System.Resources.ResourceManager包,请从project.json中删除该行。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37818224

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档