{"id":342,"date":"2011-08-25T10:30:14","date_gmt":"2011-08-25T09:30:14","guid":{"rendered":"http:\/\/floris.briolas.nl\/floris\/?p=342"},"modified":"2011-08-25T10:32:02","modified_gmt":"2011-08-25T09:32:02","slug":"type-gettype-partial-assembly-names-getting-types-of-an-assambly-in-the-gac","status":"publish","type":"post","link":"https:\/\/floris.briolas.nl\/floris\/2011\/08\/type-gettype-partial-assembly-names-getting-types-of-an-assambly-in-the-gac\/","title":{"rendered":"Type.GetType, partial assembly names. Getting types of an assambly in the GAC."},"content":{"rendered":"<p>This article demonstrates what you could do when loading a type of an assembly that resides in the GAC.<\/p>\n<p>Consider this piece of code of a console application. (System.Drawing) is NOT referenced!<\/p>\n<pre class=\"c#\" name=\"code\">            \/\/Find by partial Name.\r\n            Type partial = Type.GetType(\"System.Drawing.Rectangle, System.Drawing\"); \r\n            \/\/Find type with Assambly identity\r\n            Type byIdent = Type.GetType(\"System.Drawing.Rectangle, System.Drawing, version=2.0.0.0,publicKeyToken=b03f5f7f11d50a3a,culture=neutral\");\r\n\r\n            if (partial == null)\r\n                Console.WriteLine(\"alter app.config to let this work\");\r\n\r\n            if (byIdent == null)\r\n                Console.WriteLine(\"Not found in GAC!\");\r\n\r\n            Console.ReadKey();<\/pre>\n<p>There are 2 way&#8217;s to load a type with partial assambly name.<br \/>\n1) place the assambly in the executing directory, the file will be found. (Consider the installation implications!)<br \/>\n2) Alter your app.config to<\/p>\n<pre class=\"xml\" name=\"code\">\r\n&lt;?xml version=\"1.0\" encoding=\"utf-8\" ?&gt;\r\n&lt;configuration&gt;\r\n  &lt;runtime&gt;\r\n    &lt;assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\"&gt;\r\n      &lt;qualifyAssembly partialName=\"System.Drawing\" fullName=\"System.Drawing,version=2.0.0.0,publicKeyToken=b03f5f7f11d50a3a,culture=neutral\"\/&gt;\r\n    &lt;\/assemblyBinding&gt;\r\n  &lt;\/runtime&gt;\r\n&lt;\/configuration&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article demonstrates what you could do when loading a type of an assembly that resides in the GAC. Consider this piece of code of a console application. (System.Drawing) is NOT referenced! \/\/Find by partial Name. Type partial = Type.GetType(&#8220;System.Drawing.Rectangle, System.Drawing&#8221;); \/\/Find type with Assambly identity Type byIdent = Type.GetType(&#8220;System.Drawing.Rectangle, System.Drawing, version=2.0.0.0,publicKeyToken=b03f5f7f11d50a3a,culture=neutral&#8221;); if (partial == [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[3],"tags":[7],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p61yPs-5w","_links":{"self":[{"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/posts\/342"}],"collection":[{"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":7,"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/posts\/342\/revisions"}],"predecessor-version":[{"id":349,"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/posts\/342\/revisions\/349"}],"wp:attachment":[{"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/media?parent=342"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/categories?post=342"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/floris.briolas.nl\/floris\/wp-json\/wp\/v2\/tags?post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}