How do I find out if a class and a method exist in .NET dll, from powershell? -


i'm writing powershell script remove redundant entries globalsuppressions.cs file. 1 of techniques want use check whether class , method entry refers exist. suppression entry looks this

[assembly: system.diagnostics.codeanalysis.suppressmessage("...", "...", scope = "member", target = "mynamespace.myclass#mymethod(namespace.parametertype1,... namespace.parametertypen)... 

from can extract qualified name of class, , method signature. can load dll powershell. can't figure out how ask "does class exist?" , "if does, contain method exact signature?" guess somehow achieved through reflection, far have no idea how. have 1 additional limitation, if possible, need perform check without instantiating class. script needs universal, run on many projects. there's no telling classes checked, code default constructors execute, or if have default constructor no parameters. oh, , if know solution in c#, please share it, there's chance i'll able translate powershell.

i'm not sure understand question if have assembly, gettypes list types (public , private) contained in assembly.

$assembly = [system.reflection.assembly]::loadwithpartialname("system.xml") $assembly.gettypes() | where-object { $_.name -eq "xmlnode" } 

you can call getmembers or getmethods list members/methods given type.

see http://msdn.microsoft.com/en-us/library/system.type_methods.aspx detailed api.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -