Troubles with .resx files C#

Viewed 40

Recently, I decided to update my program and decided to add the ability to change the language to it - For this, I created .resx files and filled in with data. When trying to compile I got some error related to "AL.exe" - After installing the Windows SDK the error was fixed. Unfortunately, now there was another error when trying to compile

The task "GenerateResource" has failed unexpectedly.
System.NotSupportedException: The format of the given path is not supported.
   w System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
   w System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
   w System.IO.FileInfo.Init(String fileName, Boolean checkHost)
   w System.IO.FileInfo..ctor(String fileName)
   w Microsoft.Build.Tasks.SdkToolsPathUtility.FileExists(String filePath)
   w Microsoft.Build.Tasks.SdkToolsPathUtility.GeneratePathToTool(FileExists fileExists, String currentArchitecture, String sdkToolsPath, String toolName, TaskLoggingHelper log, Boolean logErrorsAndWarnings)
   w Microsoft.Build.Tasks.GenerateResource.ComputePathToResGen()
   w Microsoft.Build.Tasks.GenerateResource.Execute()
   w Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   w Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() (MSB4018)

Compilation is successful only if I remove all .resx files from the project - Not only those created by me, but also those generated automatically from UI.

I tried to rebuild the project, clean the project, deleted the bin and obj folders.

There is no ":" sign anywhere in the filenames.

files

Deleting dots from filenames also doesn't help :/

How can i resolve my problem?

2 Answers

I think the IDE/compiler is complaining because your satellite resource files don't have a main resource file. Have you tried creating a "resource.resx" file in the Resources folder?

Following documentation may help:

Convert .resx files to binary .resources files Converting .resx files to embedded binary resource (.resources) files has significant advantages. Although .resx files are easy to read and maintain during application development, they are rarely included with finished applications. If they are distributed with an application, they exist as separate files apart from the application executable and its accompanying libraries. In contrast, .resources files are embedded in the application executable or its accompanying assemblies. In addition, for localized applications, relying on .resx files at run time places the responsibility for handling resource fallback on the developer. In contrast, if a set of satellite assemblies that contain embedded .resources files has been created, the common language runtime handles the resource fallback process.

To convert a .resx file to a .resources file, you use Resource File Generator (resgen.exe),

https://learn.microsoft.com/en-us/dotnet/core/extensions/work-with-resx-files-programmatically

resgen.exe is described here:

https://learn.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator

Related