{"id":9973,"date":"2024-12-27T12:34:46","date_gmt":"2024-12-27T11:34:46","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=9973"},"modified":"2024-12-27T14:38:14","modified_gmt":"2024-12-27T13:38:14","slug":"powershell-list-net-library-assembly-references-and-dependencies","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/powershell-list-net-library-assembly-references-and-dependencies\/","title":{"rendered":"Powershell: List .NET library\/assembly references and dependencies"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_9973 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_9973')){$('.twoclick_social_bookmarks_post_9973').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Powershell%3A%20List%20.NET%20library%2Fassembly%20references%20and%20dependencies\",\"the_excerpt\":\"Hi%2C%0D%0A%0D%0A.NET%20assemblies%20often%20have%20some%20dependencies.%20You%20can%20use%20.NET%20reflection%20tolist%20the%20dependencies%3A%0D%0A%0D%0A%5Bpowershell%5D%0D%0A%24ASM%3D%5BReflection.Assembly%5D%3A%3ALoadFile%28%26quot%3BC%3A%5Ctemp%5Cwebdriver%5Clib%5Cnetstandard2.0%5CWebDriver.dll%26quot%3B%29%0D%0A%24ASM.GetReferencedAssemblies%28%29%0D%0A%0D%0AVersion%20%20%20%20%20%20%20%20Name%0D%0A-------%20%20%20%20%20%20%20%20----%0D%0A2.0.0.0%20%20%20%20%20%20%20%20netstandard%0D%0A8.0.0.0%20%20%20%20%20%20%20%20System.Text.Json%0D%0A8.0.0.0%20%20%20%20%20%20%20%20Microsoft.Bcl.Async%20...\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/powershell-list-net-library-assembly-references-and-dependencies\\\/\",\"post_id\":9973,\"post_title_referrer_track\":\"Powershell%3A+List+.NET+library%2Fassembly+references+and+dependencies\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>Hi,<\/p>\n<p>.NET assemblies often have some dependencies. You can use .NET reflection tolist the dependencies:<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n$ASM=&#x5B;Reflection.Assembly]::LoadFile(&quot;C:\\temp\\webdriver\\lib\\netstandard2.0\\WebDriver.dll&quot;)\r\n$ASM.GetReferencedAssemblies()\r\n\r\nVersion        Name\r\n-------        ----\r\n2.0.0.0        netstandard\r\n8.0.0.0        System.Text.Json\r\n8.0.0.0        Microsoft.Bcl.AsyncInterfaces\r\n4.2.0.1        System.Threading.Tasks.Extensions\r\n8.0.0.0        System.Text.Encodings.Web\r\n<\/pre>\n<p>When loading and you got an &#8220;Retrieve the LoaderExceptions property for more information.&#8221; add the Add-Type call into a try\/catch block to get a verbose answer:<\/p>\n<p>Eable logging<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nreg add HKLM\\Software\\Microsoft\\Fusion \/v EnableLog \/d 1 \/t REG_DWORD\r\n<\/pre>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\ntry {\r\n Add-Type -Path D:\\Temp\\TestWebDriverNetCore\\bin\\Debug\\net8.0\\WebDriver.dll \r\n} \r\ncatch \r\n{\r\n write-host ( $_.Exception.LoaderExceptions) \r\n}\r\n<\/pre>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, .NET assemblies often have some dependencies. You can use .NET reflection tolist the dependencies: $ASM=&#x5B;Reflection.Assembly]::LoadFile(&quot;C:\\temp\\webdriver\\lib\\netstandard2.0\\WebDriver.dll&quot;) $ASM.GetReferencedAssemblies() Version Name &#8212;&#8212;- &#8212;- 2.0.0.0 netstandard 8.0.0.0 System.Text.Json 8.0.0.0 Microsoft.Bcl.AsyncInterfaces 4.2.0.1 System.Threading.Tasks.Extensions 8.0.0.0 System.Text.Encodings.Web When loading and you got an &#8220;Retrieve the LoaderExceptions property for more information.&#8221; add the Add-Type call into a try\/catch block to get a &hellip; <a href=\"https:\/\/michlstechblog.info\/blog\/powershell-list-net-library-assembly-references-and-dependencies\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Powershell: List .NET library\/assembly references and dependencies<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[150,344],"tags":[76,2070,1595,2069,133],"class_list":["post-9973","post","type-post","status-publish","format-standard","hentry","category-c","category-powershell-scripting","tag-net","tag-assembly","tag-dependencies","tag-library","tag-powershell"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9973","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=9973"}],"version-history":[{"count":3,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9973\/revisions"}],"predecessor-version":[{"id":9976,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/9973\/revisions\/9976"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=9973"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=9973"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=9973"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}