Skip to content

Commit 9836bef

Browse files
dellis1972jonpryor
authored andcommitted
[Xamarin.Android.Build.Tasks] Fix the inclusion of .config files in the Apk. (#16)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=40804 There was an issue with including config files in the final apk when using release builds. Firstly they were not even being picked up because the CopyConfigFiles task was expecting a list of config files not a list of assemblies which is what it was receiving. Secondly the BuildApk task was not placing them in the assemblies directory. This commit fixes both of those issues.
1 parent ff1993a commit 9836bef

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ private void AddAssemblies (ZipFile apk)
278278
apk.AddFile (assembly.ItemSpec, "assemblies").CompressionLevel = CompressionLevel.None;
279279
var config = Path.ChangeExtension (assembly.ItemSpec, "dll.config");
280280
if (File.Exists (config))
281-
apk.AddFile (config).CompressionLevel = CompressionLevel.None;
281+
apk.AddFile (config, "assemblies").CompressionLevel = CompressionLevel.None;
282282
// Try to add symbols if Debug
283283
if (debug) {
284284
var symbols = Path.ChangeExtension (assembly.ItemSpec, "dll.mdb");

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,8 +2075,8 @@ because xbuild doesn't support framework reference assemblies.
20752075
SkipUnchangedFiles="true" />
20762076

20772077
<CopyConfigFiles
2078-
SourceFiles="@(_ResolvedFrameworkAssemblies)"
2079-
DestinationFiles="@(_ShrunkFrameworkAssemblies)" />
2078+
SourceFiles="@(_ResolvedFrameworkAssemblies->'%(Identity).config')"
2079+
DestinationFiles="@(_ShrunkFrameworkAssemblies->'%(Identity).config')" />
20802080

20812081
<!-- Shrink Mono.Android.dll by removing attribute only needed for GenerateJavaStubs -->
20822082
<RemoveRegisterAttribute

0 commit comments

Comments
 (0)