{"id":1016,"date":"2020-08-09T20:23:48","date_gmt":"2020-08-09T18:23:48","guid":{"rendered":"https:\/\/ekiwi.de\/?p=1016"},"modified":"2020-08-09T20:23:48","modified_gmt":"2020-08-09T18:23:48","slug":"visual-studio-exception-xamlparseexception-filenotfoundexception","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/1016\/visual-studio-exception-xamlparseexception-filenotfoundexception\/","title":{"rendered":"Visual Studio Exception XamlParseException FileNotFoundException"},"content":{"rendered":"<p>Wer in Visual Studio (VS) programmiert und flei\u00dfig Assemblies referenziert und <a href=\"https:\/\/ekiwi.de\/index.php\/1001\/visual-studio-windows-application-in-class-library-aendern\/\">Class-Library einbindet<\/a>, stolpert mit hoher Wahrscheinlichkeit einmal \u00fcber diese schwer nachvollziehbare Fehlermeldung.<br \/>\nDie folgende Exception bezieht sich beispielhaft auf die Einbing des Assembly <em>DotNetProjects.SVGImage<\/em>:<\/p>\n<blockquote><p>System.Windows.Markup.XamlParseException: &#8218;Die Datei oder Assembly &#8222;DotNetProjects.SVGImage, PublicKeyToken=null&#8220; oder eine Abh\u00e4ngigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.&#8216;<br \/>\n<strong>Inner Exception<\/strong><br \/>\nFileNotFoundException: Die Datei oder Assembly &#8222;DotNetProjects.SVGImage, PublicKeyToken=null&#8220; oder eine Abh\u00e4ngigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.<\/p><\/blockquote>\n<p>Obwohl man meint alles richtig gemacht zu haben und auch richtig die Referencen eingebunden zu haben, kommt diese Fehlermeldung. Und es ist zum Haare raufen und M\u00e4use melken, die Ursache zu finden.<\/p>\n<p>In den <a href=\"https:\/\/stackoverflow.com\/questions\/26672062\/wpf-application-crashed-with-xamlparseexception-and-system-io-filenotfoundexcept\" target=\"_blank\" rel=\"noopener noreferrer\">einschl\u00e4gigen Internetforen<\/a> findet man wage Hinweise, dass eine Referenz nicht richtig eingebunden ist. Dass man \u00fcberpr\u00fcfen soll, ob die betreffenden <em>*.dll<\/em>-Datei im <em>bin<\/em>-Ordner sich befindet. Doch dann stellt man fest, dass in dem betreffenden Projekt, in welchem man die Methoden der Library verwende, alle Dateien am richtigen Ort sind.<\/p>\n\n<div class=\"aawp\">\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal aawp-product--bestseller aawp-product--ribbon\"  data-aawp-product-asin=\"3367108499\" data-aawp-product-id=\"5366\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"Einstieg in C# mit Visual Studio 2026  Ideal f\u00fcr Programmieranf\u00e4nger\">\n\n    <span class=\"aawp-product__ribbon aawp-product__ribbon--bestseller\">Bestseller Nr. 1<\/span>\n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3367108499?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=visual%20studio\" title=\"Einstieg in C# mit Visual Studio 2026: Ideal f\u00fcr...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/512l59ygKgL._SL160_.jpg\" alt=\"Einstieg in C# mit Visual Studio 2026: Ideal f\u00fcr...\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3367108499?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1&keywords=visual%20studio\" title=\"Einstieg in C# mit Visual Studio 2026: Ideal f\u00fcr...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            Einstieg in C# mit Visual Studio 2026: Ideal f\u00fcr...        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>Theis, Thomas(Autor)<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3367108499?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1&#038;keywords=visual%20studio\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n    \n<\/div>\n\n<h2>Ursache XamlParseException FileNotFoundException<\/h2>\n<p>Ich will nicht ausschlie\u00dfen, dass diese Fehlermeldung auch in vielen anderen Situationen auftritt und damit auch viele andere Ursachen haben kann, wie zum Beispiel, dass die Reference wirklich nicht eingebunden ist oder die *.dll am falschen Ort gespeichert ist.<\/p>\n<p>In dem hier vorliegenden Fall war es so, dass innerhalb einer Class Library (Beispiel &#8222;FTP&#8220;) die Reference richtig eingebunden war.<\/p>\n<figure id=\"attachment_1017\" aria-describedby=\"caption-attachment-1017\" style=\"width: 398px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1017 size-full\" title=\"Class-Library-Projekt mit Assembly\" src=\"\/wp-content\/uploads\/2020\/08\/class-library-mit-reference.png\" alt=\"Screenshot Visual Studio Solution Explorer: Class Library referenziert Assembly\" width=\"398\" height=\"208\" srcset=\"\/wp-content\/uploads\/2020\/08\/class-library-mit-reference.png 398w, \/wp-content\/uploads\/2020\/08\/class-library-mit-reference-300x157.png 300w\" sizes=\"auto, (max-width: 398px) 100vw, 398px\" \/><figcaption id=\"caption-attachment-1017\" class=\"wp-caption-text\">Class Library referenziert Assembly richtig<\/figcaption><\/figure>\n<p>Diese Class-Library (FTP) wird dann innerhalb eines Application-Projekt eingebunden. Und normalerweise w\u00fcrde man jetzt meinen, dass jetzt alles passt und das Application-Projekt laufen sollte, jedoch kommt zu oben genannten Exception beim jeweiligen Konstruktor innerhalb der Methode <em>InitializeComponent()<\/em>.<\/p>\n<figure id=\"attachment_1018\" aria-describedby=\"caption-attachment-1018\" style=\"width: 382px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1018 size-full\" title=\"Application Projekt ohne Assembly\" src=\"\/wp-content\/uploads\/2020\/08\/application-mit-class-library-eingebunden.png\" alt=\"Screenshot Visual Studio Solution Explorer: Application Projekt mit Class-Library ohne Assembly-Referenz\" width=\"382\" height=\"203\" srcset=\"\/wp-content\/uploads\/2020\/08\/application-mit-class-library-eingebunden.png 382w, \/wp-content\/uploads\/2020\/08\/application-mit-class-library-eingebunden-300x159.png 300w\" sizes=\"auto, (max-width: 382px) 100vw, 382px\" \/><figcaption id=\"caption-attachment-1018\" class=\"wp-caption-text\">Application Projekt mit Class-Library ohne Assembly-Referenz<\/figcaption><\/figure>\n<p>Abhilfe schafft in diesem Fall auch das Package im Hauptprojekt zu installieren und innerhalb des Application-Projekts die Reference zu setzen.<\/p>\n<figure id=\"attachment_1019\" aria-describedby=\"caption-attachment-1019\" style=\"width: 399px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-1019 size-full\" title=\"Assembly auch im Application-Projekt referenzieren\" src=\"\/wp-content\/uploads\/2020\/08\/application-mit-class-library-eingebunden-2.png\" alt=\"Screenshot Visual Studio Solution Explorer: Assembly Reference in Application Projekt\" width=\"399\" height=\"181\" srcset=\"\/wp-content\/uploads\/2020\/08\/application-mit-class-library-eingebunden-2.png 399w, \/wp-content\/uploads\/2020\/08\/application-mit-class-library-eingebunden-2-300x136.png 300w\" sizes=\"auto, (max-width: 399px) 100vw, 399px\" \/><figcaption id=\"caption-attachment-1019\" class=\"wp-caption-text\">Assembly auch im Application-Projekt referenzieren<\/figcaption><\/figure>\n\n<div class=\"aawp\">\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal\"  data-aawp-product-asin=\"3836264587\" data-aawp-product-id=\"5380\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"C# 8 mit Visual Studio 2019  Das umfassende C#-Handbuch  Spracheinf\u00fchrung Objektorientierung Programmiertechniken Aktuell zu Visual Studio 2019\">\n\n    \n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3836264587?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1\" title=\"C# 8 mit Visual Studio 2019: Das umfassende...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/41Ylil5LydL._SL160_.jpg\" alt=\"C# 8 mit Visual Studio 2019: Das umfassende...\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3836264587?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1\" title=\"C# 8 mit Visual Studio 2019: Das umfassende...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            C# 8 mit Visual Studio 2019: Das umfassende...        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>K\u00fchnel, Andreas(Autor)<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3836264587?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n            \n            \n<div class=\"aawp-product aawp-product--horizontal\"  data-aawp-product-asin=\"3446458026\" data-aawp-product-id=\"5407\" data-aawp-tracking-id=\"ekiwide0b-21\" data-aawp-product-title=\"Visual C# 2019 \u2013 Grundlagen Profiwissen und Rezepte  Inkl E-Book\">\n\n    \n    <div class=\"aawp-product__thumb\">\n        <a class=\"aawp-product__image-link\"\n           href=\"https:\/\/www.amazon.de\/dp\/3446458026?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1\" title=\"Visual C# 2019 \u2013 Grundlagen, Profiwissen und...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            <img decoding=\"async\" class=\"aawp-product__image\" src=\"https:\/\/m.media-amazon.com\/images\/I\/512iyZ8CdeL._SL160_.jpg\" alt=\"Visual C# 2019 \u2013 Grundlagen, Profiwissen und...\"  \/>\n        <\/a>\n\n            <\/div>\n\n    <div class=\"aawp-product__content\">\n        <a class=\"aawp-product__title\" href=\"https:\/\/www.amazon.de\/dp\/3446458026?tag=ekiwide0b-21&linkCode=ogi&th=1&psc=1\" title=\"Visual C# 2019 \u2013 Grundlagen, Profiwissen und...\" rel=\"nofollow noopener sponsored\" target=\"_blank\">\n            Visual C# 2019 \u2013 Grundlagen, Profiwissen und...        <\/a>\n        <div class=\"aawp-product__description\">\n            <ul><li>Visual C# 2019 \u2013 Grundlagen, Expertenwissen und Rezepte: Inkl. E-Book<\/li><li>ABIS_BUCH<\/li><li>Hanser Fachbuchverlag<\/li><\/ul>        <\/div>\n    <\/div>\n\n    <div class=\"aawp-product__footer\">\n\n        <div class=\"aawp-product__pricing\">\n            \n                            <span class=\"aawp-product__price aawp-product__price--current\"><\/span>\n            \n                    <\/div>\n\n                <a class=\"aawp-button aawp-button--buy aawp-button--icon aawp-button--icon-black\" href=\"https:\/\/www.amazon.de\/dp\/3446458026?tag=ekiwide0b-21&#038;linkCode=ogi&#038;th=1&#038;psc=1\" title=\"Bei Amazon kaufen\" target=\"_blank\" rel=\"nofollow noopener sponsored\">Bei Amazon kaufen<\/a>\n            <\/div>\n\n<\/div>\n\n    \n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Wer in Visual Studio programmiert und Assemblies sowie Class Libraries referenziert, stolpert mit hoher Wahrscheinlichkeit einmal \u00fcber diese schwer nachvollziehbare Fehlermeldung; XamlParseException FileNotFoundException.<\/p>\n","protected":false},"author":2,"featured_media":1011,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[13],"tags":[190,192,136,193,191],"class_list":["post-1016","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programmierung","tag-c","tag-csharp","tag-programmieren","tag-visual-basic","tag-visual-studio"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/1016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=1016"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/1016\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/1011"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=1016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=1016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=1016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}