Home > Mobile >  How to retrieve Controller methods from WebApi binaries?
How to retrieve Controller methods from WebApi binaries?

Time:11-05

I have already compiled and published API (ASP.NET Core WebAPI on `.NET5). I would like to retrieve a list of methods in Controller classes, from another Desktop application (WPF). In prior .NET versions I was doing it this way:

Assembly assembly = Assembly.LoadFrom(assemblyPath);
var types = assembly.GetExportedTypes().Where(a => a.FullName != null && a.FullName.StartsWith("MyTestApp.WebApi.Controllers."));

... but that doesn't work in .NET5 because for some reason no all required dlls are copied when building/publishing the project in .NET5. So I'm looking for a straight forward way to just get list of methods in a given namespaces.

Thank you for your help,

CodePudding user response:

I have added an answer to what appears to be a related post by you Microsoft libraries missing when compiling .NET5 project hopefully it resolves your questions.

CodePudding user response:

Throw your .dll assemblies in ILSpy or something similar and just decompile them?

  • Related