Bug 19326 - MSB4018 MangleLibraryResources error with Content
Summary: MSB4018 MangleLibraryResources error with Content
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.10.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-04-27 23:41 UTC by Virgile Bello
Modified: 2016-12-23 18:51 UTC (History)
6 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Virgile Bello 2014-04-27 23:41:37 UTC
We have a iOS app that references another library.
Let's say I have an iOS executable Exec1 that references a library Library1.

For some unknown reason, I get "The "MangleLibraryResources" task failed unexpectedly." (cf details after).
It complains that it can't find to resolve my assembly Library1 (but it DOES exist in the bin/iphone folder).

I noticed that it is related to Content build action since if I change all Content to None in Exec1, it works fine.
Not sure how Content could affect the Cecil AssemblyResolver since it seems quite unrelated...

error MSB4018: The "MangleLibraryResources" task failed unexpectedly.
error MSB4018: Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Library1, Version=, Culture=neutral, PublicKeyToken=null'
error MSB4018:    at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
error MSB4018:    at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
error MSB4018:    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
error MSB4018:    at Mono.Cecil.TypeReference.Resolve()
error MSB4018:    at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
error MSB4018:    at Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant)
error MSB4018:    at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
error MSB4018:    at Mono.Cecil.MetadataBuilder.AddParameter(UInt16 sequence, ParameterDefinition parameter, ParamTable table)
error MSB4018:    at Mono.Cecil.MetadataBuilder.AddParameters(MethodDefinition method)
error MSB4018:    at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
error MSB4018:    at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
error MSB4018:    at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
error MSB4018:    at Mono.Cecil.MetadataBuilder.AddTypeDefs()
error MSB4018:    at Mono.Cecil.MetadataBuilder.BuildTypes()
error MSB4018:    at Mono.Cecil.MetadataBuilder.BuildModule()
error MSB4018:    at Mono.Cecil.ModuleWriter.<BuildMetadata>b__0(MetadataBuilder builder, MetadataReader _)
error MSB4018:    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
error MSB4018:    at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
error MSB4018:    at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
error MSB4018:    at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
error MSB4018:    at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
error MSB4018:    at Xamarin.MonoTouch.Build.Tasks.MangleLibraryResources.EmbedResourcesOnAssembly(String assemblyPath, ITaskItem[] resources, String projectDir, String[] prefixes)
error MSB4018:    at Xamarin.MonoTouch.Build.Tasks.MangleLibraryResources.Execute()
error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
Comment 1 Virgile Bello 2014-04-27 23:44:47 UTC
Sorry, my bad, the files that I need to switch from Content to None are in Library1.
Comment 2 Prashant manu 2014-05-01 06:17:23 UTC
As per comment 1 closing this issue.
Comment 3 Virgile Bello 2014-05-01 06:40:44 UTC
No, I mean the issue is still valid, it was to correct my comment.
Comment 4 Virgile Bello 2014-05-13 21:51:07 UTC
Just to clarify:
I meant that the files I had to changes from Content to None were in Library1, not Exec1 (but problem might still apply to both anyway, not sure).

This issue is still present (and very hard to diagnostic).

Sorry for the confusion.
Comment 5 Emanuel 2016-12-23 18:51:13 UTC
As we've added several improvements to our build system and deploying/debugging
mechanism since the bug was reported, I'm resolving it tentatively as Fixed.
That said, if you're still facing this issue with current bits, please feel
free to reopen the bug.