Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging assemblies with a reference to Autofac #58

Closed
mauricedb opened this issue Apr 30, 2014 · 10 comments
Closed

Merging assemblies with a reference to Autofac #58

mauricedb opened this issue Apr 30, 2014 · 10 comments
Labels
Milestone

Comments

@mauricedb
Copy link

I am trying to ILMerge a project containing Autofac.dll and that fails on that dependency.

The command I am using is: ILRepack.exe /out:Merged.exe ILRepackTest.exe Autofac.dll

Expected outcome

To have ILRepackTest.exe and Autofac.dll to be merged to Merged.exe

Observed output is the following exception:

Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name)
at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
at Mono.Cecil.ModuleDefinition.Resolve(TypeReference type)
at Mono.Cecil.TypeReference.Resolve()
at ILRepacking.ReferenceFixator.FixReferences(Collection`1 attributes)
at ILRepacking.ReferenceFixator.FixReferences(MethodDefinition meth)
at ILRepacking.ReferenceFixator.FixReferences(TypeDefinition type)
at ILRepacking.ILRepack.Repack()
at ILRepacking.ILRepack.Main(String[] args)

Note

My understanding is this is because Autofac is created as a portable class library. See https://github.com/autofac/Autofac/wiki/Frequently-Asked-Questions

@damianh
Copy link

damianh commented Apr 30, 2014

Looks like a known problem Mono.Cecil jbevain/cecil#152

@lextm
Copy link

lextm commented Sep 8, 2014

@damianh Yes, I think that's a known problem. The possible fix is to modify RepackAssemblyResolver to add PCL related paths to Cecil search paths. I have just done that for Obfuscar, and just started to work on testing it out on IL-Repack. Will send a pull request when I finish.

lextm added a commit to lextm/il-repack that referenced this issue Sep 8, 2014
@dennisdoomen
Copy link

Unfortunately this still doesn't work. Just try to merge a .NET 4.5 assembly with Autofac and the same problem with System.Core appears.

@schuettecarsten
Copy link

Problem still there with ILRepack 1.26

@gluck
Copy link
Owner

gluck commented May 17, 2015

Strange, there's now a passing test that round trips Autofac net45 assembly (with no error).
Do you have an easy reproduction path ? (ideally that would be the merge of a set of dlls available from NuGet packages)

@dennisdoomen
Copy link

Yes, just merge a DLL that references Autofac and then try to merge that one in another .DLL that also references Autofac, preferably a different version.

@schuettecarsten
Copy link

This also happens without Autofac. It seems to be a problem with Assemblies from .net 4.5. I have a simple application that references System.Core and several Azure Management assemblies.

@gluck
Copy link
Owner

gluck commented May 18, 2015

If someone can provide the simplest project or assembly that causes this when merged, I can have a look.
Autofac NuGet package only has a net40 dll and a portable-win+net40+sl50+wp8 one, tests are running with the former only so far.

@biz0n
Copy link

biz0n commented May 18, 2015

I am trying to merge a libraries from zip archive
The command I am using is:
mono ILRepack.exe /targetplatform:v4 /out:test.dll Autofac.dll Nitro.Async.dll

OS X 10.10.3

gluck added a commit that referenced this issue May 19, 2015
- add the fwk folder as a search directory, to avoid relying
  on current execution fwk (as Cecil does)
- will work for mono (supposedly) if one provides the fwk path
  in the arguments (/targetframework:v4,/path/to/mono/fwk)
@gluck gluck added the bug label May 21, 2015
@gluck gluck added this to the 2.0.0 milestone May 21, 2015
@gluck gluck closed this as completed Jun 7, 2015
@SarahBourgeois
Copy link

specify the path of your dll in the command line
ILRepack.exe /out:Merged.exe ILRepackTest.exe C:\My_dll_Path\Autofac.dll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants