il-repack
il-repack copied to clipboard
Option to exclude external assembly
Hi. I'm getting the error "Failed to resolve assembly" during merge. The problem is that I don't need this assembly to be merged as it will be available in target environment.
Let ILRepack be able to resolve an assembly (so that Mono Cecil can read the metadata), and that does not mean you need to merge that assembly with others. I think you just misunderstood the concepts.
How can I do this? This assembly is available in the same folder as my. What should I do to let ILRepack to be able to resolve it?
p.s. ILMerge is ok with that so I consider this is an ILRepack issue/feature
if it is .NET Framework assembly you could specify path to Framework's location "/targetplatform:v4,<PATHTOFRAMEWORK>"
No it is part of MS Dynamics 365 SDK. The problem is that target system use reflection to create instance of my classes, so they must be extended from external type which is part of SDK assembly
You may need to specify /lib:<FOLDER_INCLUDING_THE_ASSEMBLY>
.
I didn't think it was required if the assembly was in the same folder of one of the assemblies you're trying to merge, but give it a try already.
It looks like it work. Error has gone and I don't see SDK assembly classes using reflector. May I suggest it is still a bug?
It looks like it has never been the case, it could be implemented though. cf https://github.com/gluck/il-repack/blob/3829e3db36ffbf511fcec05316bbf36b33ce83fb/ILRepack/ILRepack.cs#L391
Hello there! I have the same issue. We are developing Model-driven apps on Microsoft PowerPlatform (re-branded dynamics). We were using ILMerge and it worked just fine, until we switched to the new .csproj structure. Can someone help me out?
I'm using ILRepack 2.0.16. I'm referencing a few projects and two other nugget packages:
My .csproj looks like this:
With this setup, I'm encountering the same issue:
Based on this thread, I tried this:
And got this result:
But I have no luck with this setup. Am I doing something wrong? Thanks for help. <3
Hello @honzakostejn,
I use this tool for the same purpose. I highly recommend you to use this MSBuild taks: https://github.com/ravibpatel/ILRepack.Lib.MSBuild.Task. You can see sample config here: https://github.com/FixRM/D365Extensions
@FixRM,
thanks a lot! I'll definitely go through your repo.
But I managed to solve my issue today. I just tweaked .csproj a little. It works just fine. I'll write short blogpost and post it here, if someone had the same issue.
@honzakostejn my friend, I need your blog post so desperately...
@wh1t3cAt1k I'll try to whip it back online... :)
update: I've republished the blogpost: https://blog.thenetw.org/2019/01/10/how-to-merge-assemblies-cds/
The resolver has been improved in the latest version, please try the latest and open a new bug if there's still an ILRepack issue. Thanks.