添加 .resx 文件时使用 WPF .net Core 3.0 编译错误

Compile error with WPF .net Core 3.0 when adding .resx files

以下按预期工作: VS Studio 2019 经过专业和社区测试。

按预期编译

以下无效:

使用 VS 2019 专业版和社区在 3 台不同的机器上对其进行了测试

编译错误:

Error Custom tool PublicResXFileCodeGenerator failed to produce an output for input file 'Resources\Resources.de.resx' but did not log a specific error. WpfApp4 C:...\source\repos\WpfApp4\WpfApp4\Resources\Resources.de.resx 1

Error MSB3086 Task could not find "al.exe" using the SdkToolsPath "" or the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK.7.2\WinSDK-NetFx40Tools-x86". Make sure the SdkToolsPath is set and the tool exists in the correct processor specific location under the SdkToolsPath and that the Microsoft Windows SDK is installed WpfApp4 C:\Program Files (x86)\Microsoft Visual Studio19\Professional\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 3639

编辑:还在 Microsoft

创建了一个 Ticket

https://developercommunity.visualstudio.com/content/problem/771961/compile-error-with-wpf-net-core-30-when-adding-res.html

尝试安装 .NET Framework 4.7.2 Developer Pack。仅编译时需要。

在 VisualStudio 2019 中的一个 asp.net 核心 3.1 网站项目(使用全球化)中,我在使用现有资源文件时遇到了这个问题。

解决问题:

  1. 创建了一个新的 Resource.resx。 (使用添加>新项目...>资源 File.resx.
  2. 将第一个文件的所有内容复制到新文件中(Copy 所有三列)。
  3. 删除旧文件。
  4. 将新文件重命名为预期名称。

它对我有用。我希望它也适合你。