gpt4 book ai didi

c# - .NET Core RC2 - NeutralResourcesLanguageAttribute

转载 作者:行者123 更新时间:2023-11-30 16:48:42 24 4
gpt4 key购买 nike

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

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

我的问题是,在编译为新的 NET Standard 框架等框架时,我现在必须向 System.Resources.ResourceManager 添加依赖项,否则它不会编译。

有什么办法可以避免这种情况吗?

这是我当前的 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"
}
}
}
}

最佳答案

包含 [NeutralResourcesLanguage] 属性,因为您要求包含它,通过设置 "language": "en-US" 在你的 project.json 中。

如果您不想依赖 System.Resources.ResourceManager 包,请从您的 project.json 中删除该行。

关于c# - .NET Core RC2 - NeutralResourcesLanguageAttribute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37818224/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com