jeudi 15 décembre 2016

How to get web application assembly information from console application by reflection


I need to get a list of controller/action method names
of mvc web application
from a console application.

So I use reflection to do this.
I referenced web application's .dll to console application.
But I can not get web application's assembly information from console application source.

var check = AppDomain.CurrentDomain.GetAssemblies();
var assembly = AppDomain.CurrentDomain.GetAssemblies()
.First(x =>x.ManifestModule.Name == "RedStar.WebApp.dll");

throws this exceptipn 'System.InvalidOperationException' 'Sequence contains no matching element'





Aucun commentaire:

Enregistrer un commentaire