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

Remove assembly reference? #59

Closed
picrap opened this issue Mar 5, 2016 · 5 comments
Closed

Remove assembly reference? #59

picrap opened this issue Mar 5, 2016 · 5 comments

Comments

@picrap
Copy link

picrap commented Mar 5, 2016

Is there a way to remove an assembly reference?
I want to write an application to embed or merge assemblies using dnlib; however, I'm stuck in an early stage, since I can't remove the referenced assembly.

@0xd4d
Copy link
Collaborator

0xd4d commented Mar 5, 2016

You don't need to remove anything. The assembly writer doesn't add assembly
references that aren't referenced by types, methods or code.

@picrap
Copy link
Author

picrap commented Mar 5, 2016

But the reference stays if I embed the assembly as a resource and extract it when the AppDomain wants to resolve it.
Do you have any idea of how I shall proceed?

@0xd4d
Copy link
Collaborator

0xd4d commented Mar 5, 2016

There's some code that reference it, or the assembly reference wouldn't be added to the assembly. You can set a BP @ https://github.com/0xd4d/dnlib/blob/master/src/DotNet/Writer/MetaData.cs#L1917 and see which reference is still left in the code that needs that assembly.

@picrap
Copy link
Author

picrap commented Mar 5, 2016

All references remain, that's the idea: however, instead of using an external assembly, I use an embedded resource and extract it when needed. This way, all references are embedded in the main assembly.

@picrap
Copy link
Author

picrap commented Mar 5, 2016

Apparently, removing the reference is not necessary, so I close the issue.

@picrap picrap closed this as completed Mar 5, 2016
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

1 participant