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

Force exclude a library reference from being merged in #40

Open
MWstudios opened this issue Nov 9, 2023 · 2 comments
Open

Force exclude a library reference from being merged in #40

MWstudios opened this issue Nov 9, 2023 · 2 comments

Comments

@MWstudios
Copy link

I'm trying to merge a library X that references an optional library Y (it can run without it, any potential exceptions are ignored). However, ILRepack goes out of its way to merge all references, including the optional ones that I removed from my project, which results in "Failed to resolve assembly: Y". I tried adding <InputAssemblies Exclude="Y"/> but the error still occurs.

The only solution I can think of is to make a copy of X that doesn't reference Y at all, but then I would have to update two copies of X in parallel.

How can I force exclude a library reference so ILRepack won't try to merge it?

@KirillOsenkov
Copy link
Contributor

When you get "Failed to resolve assembly: Y" it doesn't mean that ILRepack wants to merge it, it means that it just needs to read Y to be able to understand X better. You can help ILRepack by providing a /lib: where it can resolve Y from. If you provide a directory with Y instead of specify Y directly, it will not get merged.

@MWstudios
Copy link
Author

Thank you! To whomever sees this in the future, I wrote:

<ILRepack
    LibraryPath="extra_dlls_dir"
    />

or

<ILRepack
    LibraryPath="@(LibraryPath)"
    />

<ItemGroup>
    <LibraryPath Include="extra_dlls_dir"/>
</ItemGroup>

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

2 participants