开发者

Can I view the public API of my class library in Visual Studio?

开发者 https://www.devze.com 2023-02-17 08:44 出处:网络
Using the Object Browser, I see everything, public, internal, private.How can I see o开发者_运维技巧nly the public API of my class library?

Using the Object Browser, I see everything, public, internal, private. How can I see o开发者_运维技巧nly the public API of my class library?

If not, is there another tool I can use to browse my class library's public API? I'm trying to get an outside-in view of my library.


You can use Reflector and limit the visibility options under 'View' -> 'Options' -> 'Browser' to 'Public items only':

Can I view the public API of my class library in Visual Studio?


In the object browser to filter only public items on an individual class. This doesn't filter the left hand pane of the browser so you still see private types there.

Can I view the public API of my class library in Visual Studio?

You can also use the ILDASM tool that ships with the Windows SDK. This gives a bunch more filtering options and filters things from the tree fiew completely. It's really a disassembly viewer to it's not as pretty.

Can I view the public API of my class library in Visual Studio?

You can download the SDK from here: http://msdn.microsoft.com/en-us/windows/bb980924

It will install in: C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\NETFX 4.0 Tools\ildasm.EXE

You can also use Reflector. This used to be free but now seems to be a paid product that will uninstall the free version when it updates. IMO reflector is the best tool for this but only if you feel like buying it. It starts at $35 for the basic version http://www.reflector.net/.


By referencing the class library in another project, when I view it in that Object Browser, it shows the public API only.


The ApiChange tool allows you to query on the command line and to export the results to Excel. E.g.

ApiChange.exe -wt "public class *" <YourDll.dll> -in gac:\system.dll -excel 

This will search for all public classes in your dll and search for users of your types in system.dll. There will be none but you will get a full listing for all of your classes.

The type query format is defined by: Visibility ClrType TypeName

  • Visibility can be public | internal
  • ClrType can be class | interface | struct | enum
  • TypeName is the full qualified type name or a partial name or only a namespace query. The string after the last . is treated as the actual type name.

Valid Type Queries are

  • System.Diagnostics.Stopwatch
  • Stopwatch
  • stopwatch
  • stopw*
  • System.*.Stopwatch
  • public class *

Yours, Alois Kraus

0

精彩评论

暂无评论...
验证码 换一张
取 消