简体   繁体   中英

.NET Core RC2 - NeutralResourcesLanguageAttribute

With the new release of .NET Core RC2, when compiling the project using the new SDK 1.0.0-preview1-002702 (after a migration from version 1.0.0-rc1-update1 ) it is generating, for each framework, a file dotnet-compile.assemblyinfo.cs containing the attribute System.Resources.NeutralResourcesLanguageAttribute . Example:

// <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")]

My problem is, when compiling to frameworks like the new NET Standard framework, I now have to add a dependency to System.Resources.ResourceManager or it won't compile.

Is there a way to prevent this?

This is my current project.json :

{
  "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"
      }
    }
  }
}

The [NeutralResourcesLanguage] attribute is included, because you're asking for it to be included , by setting "language": "en-US" in your project.json.

If you don't want to depend on the System.Resources.ResourceManager package, remove that line from your project.json.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM