@@ -18,6 +18,7 @@ def _copy_file(script_body, src, dst, is_windows):
1818
1919def _get_assembly_files (assembly_info , transitive_runtime_deps , deps_json_struct ):
2020 libs = [] + assembly_info .libs
21+ resource_assemblies = [] + assembly_info .resource_assemblies
2122 native = [] + assembly_info .native
2223 data = [] + assembly_info .data
2324 appsetting_files = assembly_info .appsetting_files .to_list ()
@@ -37,7 +38,8 @@ def _get_assembly_files(assembly_info, transitive_runtime_deps, deps_json_struct
3738 libs .append (file )
3839
3940 data += dep .data
40- return (libs , native , data , appsetting_files )
41+ resource_assemblies += dep .resource_assemblies
42+ return (libs , resource_assemblies , native , data , appsetting_files )
4143
4244def _copy_to_publish (ctx , runtime_identifier , runtime_pack_info , binary_info , assembly_info , transitive_runtime_deps , deps_json_struct ):
4345 is_windows = ctx .target_platform_has_constraint (ctx .attr ._windows_constraint [platform_common .ConstraintValueInfo ])
@@ -50,7 +52,7 @@ def _copy_to_publish(ctx, runtime_identifier, runtime_pack_info, binary_info, as
5052
5153 _copy_file (script_body , binary_info .dll , main_dll_copy , is_windows = is_windows )
5254
53- (libs , native , data , appsetting_files ) = _get_assembly_files (assembly_info , transitive_runtime_deps , deps_json_struct )
55+ (libs , resource_assemblies , native , data , appsetting_files ) = _get_assembly_files (assembly_info , transitive_runtime_deps , deps_json_struct )
5456
5557 # All managed DLLs are copied next to the app host in the publish directory
5658 for file in libs :
@@ -61,6 +63,17 @@ def _copy_to_publish(ctx, runtime_identifier, runtime_pack_info, binary_info, as
6163 inputs .append (file )
6264 _copy_file (script_body , file , output , is_windows = is_windows )
6365
66+ # Resource assemblies are copied next to the app host in the publish directory in a folder
67+ # that has the same name as the locale of the resource assembly.
68+ # Example: `de/MyAssembly.resources.dll`
69+ for file in resource_assemblies :
70+ locale = file .dirname .split ("/" )[- 1 ]
71+ output_dir = "{}/publish/{}/{}/{}" .format (ctx .label .name , runtime_identifier , locale , file .basename )
72+ output = ctx .actions .declare_file (output_dir )
73+ outputs .append (output )
74+ inputs .append (file )
75+ _copy_file (script_body , file , output , is_windows = is_windows )
76+
6477 # When publishing a self-contained binary, we need to copy the native DLLs to the
6578 # publish directory as well.
6679 for file in native :
0 commit comments