Skip to content

Alternative to Assembly.ReflectionOnlyLoad() for .NET Core tasks #8650

Discussion options

You must be logged in to vote

System.Reflection.MetadataLoadContext would ensure that nothing is executed from the assembly. However, it will require you to provide mscorlib.dll or equivalent. If you cannot provide that, then System.Reflection.Metadata.MetadataReader could read the types, attributes etc. without resolving any references, but its API is very different.

Does your MSBuild task immediately register the add-ins in the Registry of the computer on which the task is run, or does it set up a registration script for later execution? In the former case, the task requires Windows anyway, so consider building a .NET Framework executable and running that out of process from the task.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jozefizso
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants