{"id":9473,"date":"2022-09-05T19:00:48","date_gmt":"2022-09-05T19:00:48","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=9473"},"modified":"2022-09-05T19:00:48","modified_gmt":"2022-09-05T19:00:48","slug":"communitytoolkit-mvvm-already-contains-a-definition-for-error","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/communitytoolkit-mvvm-already-contains-a-definition-for-error\/","title":{"rendered":"CommunityToolkit.Mvvm &#8220;already contains a definition for&#8221; error"},"content":{"rendered":"<p>The CommunuityToolkit.Mvvm includes a wonderful MVVM source generator, but in the current .NET 6.0 release I&#8217;m using, (doesn&#8217;t happen with MAUI but does with WPF) I get errors such as <\/p>\n<ul>\n<li>The type &#8216;MyViewModel&#8217; already contains a definition for &#8216;MyProperty&#8217;<\/li>\n<li>A partial method may not have multiple defining declarations<\/li>\n<\/ul>\n<p>To fix this (at least in the current version of .NET 6.x) add a global.json file to the folder with your solution file <\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n{\r\n  &quot;sdk&quot;: {\r\n    &quot;version&quot;: &quot;6.0.202&quot;,\r\n    &quot;rollForward&quot;: &quot;disable&quot;\r\n  }\r\n}\r\n<\/pre>\n<p>and things should work correctly &#8211; hopefully this post will be obsolete soon with the issue fixed, but for now this solves the problem.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The CommunuityToolkit.Mvvm includes a wonderful MVVM source generator, but in the current .NET 6.0 release I&#8217;m using, (doesn&#8217;t happen with MAUI but does with WPF) I get errors such as The type &#8216;MyViewModel&#8217; already contains a definition for &#8216;MyProperty&#8217; A partial method may not have multiple defining declarations To fix this (at least in the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[330,13],"tags":[],"class_list":["post-9473","post","type-post","status-publish","format-standard","hentry","category-maui","category-wpf"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9473","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=9473"}],"version-history":[{"count":1,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9473\/revisions"}],"predecessor-version":[{"id":9474,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/9473\/revisions\/9474"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=9473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=9473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=9473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}