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

il-repack doesn't work with localized satellite assemblies #158

Open
ravibpatel opened this issue Jun 18, 2016 · 5 comments
Open

il-repack doesn't work with localized satellite assemblies #158

ravibpatel opened this issue Jun 18, 2016 · 5 comments

Comments

@ravibpatel
Copy link

I tried to integrate third party class library satellite assemblies in to my executable but it doesn't work. Although I can use the SingleAssemblyComponentResourceManager from following discussion and made it work.

http://stackoverflow.com/questions/1952638/single-assembly-multi-language-windows-forms-deployment-ilmerge-and-satellite-a

But I can't do it manually for every third party class libraries I use. is there any way where il-repack can change all the references to ComponentResourceManager class to SingleAssemblyComponentResourceManager?

Thanks.

@gluck
Copy link
Owner

gluck commented Jun 18, 2016

OOB no. It's probably doable if you want to hack the code, could be as simple as injecting an extra type mapping as the code already needs a pass to handle renamed types.

In order to be more generic you could add support for an attribute, e.g:

[RepackForwardedType(typeof(ComponentResourceManager))]
Class SingleAssemblyComponentResourceManager
....

Let me know if you feel like implementing it.

@deniszykov
Copy link
Contributor

I solved a similar problem with following code (.NET and Mono):
https://gist.github.com/deniszykov/0af842aded2b5cd570b3bb9269ee5aef

@JustArchi
Copy link

JustArchi commented Jan 7, 2017

Is there any chance ILRepack can actually work OOB with those localized DLLs without unnecessary hacky code changes?

I'm currently using Fody.Costura + Resource.Embedder for merging normal dlls and satellite assemblies. It really works out of the box, but has two major disadvantages: doesn't seem to work on Mono, and output binary can't be installed as a windows service with InstallUtil.exe.

Is there any chance for ILRepack to achieve what Resource.Embedder does? It's definitely possible to achieve it without any code changes, but due to the way how ILRepack works I'm not quite sure if what I'm asking even makes sense.

I tried to embed those DLLs using classic way of merging that I've been doing for normal DLLs since ever, but as you can guess they're not being picked later during runtime, despite of being merged with success.

I can't really ask for anything much considering this is probably very niche subject, but it'd be lovely if ILRepack was able to handle this OOB like Resource.Embedder does. Or at least if there was a plan to add that eventually, or at least a possibility, anything... 😭

@gluck
Copy link
Owner

gluck commented Jan 16, 2017

AFAICT it could be done following ILRepack way, but requires some work along the lines of:

  • merge all resource dlls, renaming the resources inside
  • inject some init code (e.g. as suggested by @deniszykov ) to hack the ResourceManager and inject resources manually in it

Resource.Embedder way involves less magic, as it only hooks into assembly resolution, it should work with an ILRepack'ed library, but probably that won't fit your need ? (not sure about the limitations of InstallUtil.exe)

@JustArchi
Copy link

It could probably work, but Resource.Embedder didn't work on Linux/Mono last time I tried, and in fact, I love ILRepack for being able to work on both Windows and Mono at the same time, while those nice and clean magical libraries usually work only on Windows, hence I'm asking.

Thank you very much for response - the fact that it's possible alone makes me very happy. Perhaps eventually we could see it done, I'd even implement it myself and send PR if I had decent knowledge about that, but sadly I don't - that's also why I asked if it's even possible, as I have no clue how deep magic ILRepack does, but I know it's decent 😀 .

Overall I hope that eventually we could see a feature that makes it possible, but that's only my wish and I don't want to ask people coding feature purely for me, especially since it's a very niche topic. Thanks a lot for an answer and considering it though! I appreciate it a lot.

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

No branches or pull requests

4 participants