<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Cool tools</title>
        <link>http://geekswithblogs.net/RSabourin/category/8179.aspx</link>
        <description>Cool tools</description>
        <language>en-US</language>
        <copyright>Remi Sabourin</copyright>
        <managingEditor>remi.sabourin@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Dependency Management</title>
            <link>http://geekswithblogs.net/RSabourin/archive/2008/07/24/dependency-management.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;The Challenge&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;Imagine a development shop that maintains 100 .Net solutions, each composed of multiple projects. Imagine roughly half of these being shared domain services or shared common libraries, the other half being end web applications servicing multiple large clients.  Imagine any given project having the ability to reference classes/methods on any suitable re-usable service.   Imagine trying to get a grip on it all - a great architectural paradise or a great architectural nightmare.  Welcome to my world!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;For a while I have been thinking about a way to manage dependencies.  Dependencies hold us back, they make us scared to change things.  But when we don't evolve, we don't improve, we spend time doing complete rewrites or adding layer over layer of code bloat and we don't refactor to achieve enough of my favorite thing..... (c'mon guys, you know it's coming).... RE-USE.  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;I am dreaming of a searchable database of dependencies, most it being automatically generated and updated, although some could be specified manually if indirect.  Basically a master tool that would spider our build and production server(s) and document dependencies to any artifact - code, databases, folders, etc.   If we want to remove/update/rename anything, we can be confident in our actions.  It would point out orphans that we can clean up so as to keep our systems/code clean.  It would plug into an automated build process and send dependency reports and alerts.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;&lt;strong&gt;The Research&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial" size="2"&gt;Voice inside my head says "Start with the code".  I want to know for every method/property what method/property calls it in any project. Here's what has transpired so far:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;First I figure a little app that calls the .Net framework could be in order, that spits the results to a database.  I know System.Reflection has metadata on dlls built in. On further inspection, System.Reflection only exposes things in the manifest, which does include assembly references (a start), but does not provide an insight into method references.  Next I look at the CodeDom namespace - if similar to XML DOM, I could create a solution to parse the source code and I could iterate the dom to find function calls.  In fact, there is a CreateParser() method - too bad for me there's no implementation. Maybe in a future .Net version?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;I took a look at NRefactory that is an API that comes with the SharpDevelop IDE but can't find much documentation on this to see if it could do the job.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Examined some out-of-the-box add-ins/tools, NDepends being a possibility.  I figured I would have an automated build output an XML file from NDepends and then I could have code that parses it for the dependencies and puts them in a database..  NDepends looks like a good tool with some interesting features and a query language, but it does not output method dependencies (only type and assembly ones), although you can see them if you drill down using the application.  There is also licensing per individual. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;I thought dlls could maybe be reversed engineered; there is a tool that comes with .Net called ildasm.exe.  Its output though is intermediate language code which I'm not familiar with and would be kindof brutal to parse.  I found out Reflector has a "hidden" API if you reference the EXE.  &lt;font face="Arial"&gt; A nice MSDN article that has a promising name by James McCaffrey: &lt;font face="Arial"&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163641.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/cc163641.aspx&lt;/a&gt;. May try this out, does not seem like the perfect high-level API but may not be too complicated knowing what exact statements to look for in intermediate language.&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Then found out that FxCop also has a "hidden" API if you reference the EXE. Here's a nice doc Jason Kresowaty created to document this API: &lt;font face="Arial"&gt;&lt;a href="http://www.binarycoder.net/fxcop/pdf/fxcop.pdf"&gt;http://www.binarycoder.net/fxcop/pdf/fxcop.pdf&lt;/a&gt;.  This looks like the abstract API I was looking for.  This is my best bet right now&lt;/font&gt;&lt;font face="Arial"&gt;.&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="2"&gt;The Execution&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Concluding my research, my goal in the next few weeks is to:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;- Use System.Reflection to log all the assembly references found in dlls&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;- Use FxCop or Reflector API to log all the method references found in dlls&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;- Log all the source code in the database (if this is impractical, use indexing service) so I can query it.  What the hey, why not use SQL Server's scptxfr.exe utility and log all the stored procs/views/triggers too.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;- Have a GUI for the development teams that displays dependencies between assemblies and allows you to drill down to methods.  Have GUI that allows you to search for ad hoc strings in the source code..&lt;font color="#ff0000"&gt;&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;I'll let you know how it turns out.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;P.S. If you know of some wicked tool that can do this for me and allow me to RE-USE and conserve time, let me know! &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=123989"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=123989" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/RSabourin/aggbug/123989.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Remi Sabourin</dc:creator>
            <guid>http://geekswithblogs.net/RSabourin/archive/2008/07/24/dependency-management.aspx</guid>
            <pubDate>Thu, 24 Jul 2008 07:09:32 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/RSabourin/comments/123989.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/RSabourin/archive/2008/07/24/dependency-management.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/RSabourin/comments/commentRss/123989.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>