简体   繁体   English

从 .resx 为 .NET Core 3.1 应用程序生成资源 dll

[英]Generate resource dll from .resx for .NET Core 3.1 applications

It's my first post here, so I hope I do anything right.这是我在这里的第一篇文章,所以我希望我做对了。

I'm working for a company that is developing a .NET Core application inside Windows, using c# and VS 2019. The version I'm using of .NET Core is 3.1.我在一家使用 c# 和 VS 2019 在 Windows 中开发 .NET Core 应用程序的公司工作。我使用的 .NET Core 版本是 3.1。 Visual studio is updated to the latest version (14.5). Visual Studio 已更新到最新版本 (14.5)。

We've already written all the UI, and we were wondering if there is any way to generate, from a resx file, the associated localization DLL.我们已经编写了所有 UI,我们想知道是否有任何方法可以从 resx 文件生成关联的本地化 DLL。

This could be useful, for the translator along Europe to localize the application and test the result inside the application.这对于欧洲的翻译人员本地化应用程序并测试应用程序内的结果可能很有用。

I was searching for a way to do that (generate dll from resx) for several days, without being able to correctly find a way to successfully generate this dll from the resx file generated by VS.几天来,我一直在寻找一种方法来做到这一点(从 resx 生成 dll),但无法正确找到从 VS 生成的 resx 文件中成功生成此 dll 的方法。 Whats I've tried so far:到目前为止我尝试过什么:

  1. Using Resgen and al.exe with several parameters and a combination of them.使用带有多个参数及其组合的 Resgen 和 al.exe。 I got the result that the dll was generated but not loaded from the application我得到的结果是 dll 已生成但未从应用程序加载
  2. Using csc.exe with the input the resx file to be translated.使用 csc.exe 和输入要翻译的 resx 文件。 I got as result a dll that was not loaded from the application结果我得到了一个未从应用程序加载的 dll
  3. Try different version of dotnet SDK, calling "dotnet csc.dll" from the SDK folders, without being able to generate a valid dll loaded from the application尝试不同版本的 dotnet SDK,从 SDK 文件夹调用“dotnet csc.dll”,但无法生成从应用程序加载的有效 dll

My question now is, is there any way to generate not from inside VS a temporary dll that can be loaded from translator machine to test the application or, the only way is to have the resx file from him and then generate from developer machine the dll and give back to the translator in order to be properly tested?我现在的问题是,有没有办法不从 VS 内部生成一个临时 dll,该 dll 可以从翻译机加载以测试应用程序,或者,唯一的方法是从他那里获得 resx 文件,然后从开发者机器生成 dll并交还给翻译人员以便进行适当的测试? If not, is there a way to generate the resx built dll from VS Community without having all the source code (as you can imagine, we don't want to redistribute our source)?如果没有,有没有办法在没有所有源代码的情况下从 VS 社区生成 resx 构建的 dll(如您所想,我们不想重新分发我们的源代码)? Any other ideas on how we can solve this problem?关于我们如何解决这个问题的任何其他想法?

Another idea that came up to our mind is to create a separate resource project, and distribute that to our translator.我们想到的另一个想法是创建一个单独的资源项目,并将其分发给我们的翻译人员。 I think I'll try this path during the afternoon if no other useful ideas come up from here.如果这里没有其他有用的想法,我想我会在下午尝试这条路。

Thanks in advance for any reply to this post.提前感谢您对此帖子的任何回复。

You can use two methods您可以使用两种方法

1) RegGen + Assembly Linker 1) RegGen + 程序集链接器

Use ResGen.exe to compile the localized .resx files into .resources Then use AL.exe to link the satellite assembly file使用 ResGen.exe 将本地化的 .resx 文件编译为 .resources 然后使用 AL.exe 链接卫星程序集文件

or或者

2) Use Visual Studio. 2) 使用 Visual Studio。

Just add the localized .resx file into your csproj file.只需将本地化的 .resx 文件添加到您的 csproj 文件中。 Next time you build, Visual Studio also builds the satellite assemblies.下次生成时,Visual Studio 还会生成附属程序集。

Before you can create the satellites you need to have the localized .resx files.在创建卫星之前,您需要有本地化的 .resx 文件。 Use a localization tool to create them.使用本地化工具来创建它们。 For example Soluling .例如Soluling

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有资源文件 (resx) 的 asp.net 核心 - asp.net core with resource file (resx) Is there a way to restrict .NET Core projects to generate only.dll as output files when using .NET Core 3.1 sdk - Is there a way to restrict .NET Core projects to generate only .dll as output files when using .NET Core 3.1 sdk .net 核心 3.1 本地化 resx 命名的明显重大变化? - Apparent breaking change for .net core 3.1 localization resx naming? 如何从 .net Core 3.1 dll (WPF) 访问 Dispatcher - How to access the Dispatcher from a .net Core 3.1 dll (WPF) 在.net core 3.1项目中使用vb dll - using vb dll in .net core 3.1 project 如何使用从 .Net Core 3.1 中的 web.config 读取的 DLL? - how can I use a DLL that reades from web.config in .Net Core 3.1? 如何在 javascript 文件中使用 resx 文件。 .net核心3.1 mvc - How to use resx file in javascript file. .net core 3.1 mvc 如何从 .NET 资源 (RESX) 文件中按字符串值获取名称 - How to get Name by string Value from a .NET resource (RESX) file 从 .NET Core 3.1 WinForms 中的资源文件中检索字符串值(需要简单示例) - Retrieve string value from resource file in .NET Core 3.1 WinForms (need simple example) 从.Net Core 3.1 迁移到 .NET 5 - Migrating from .Net Core 3.1 to .NET 5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM