I had the code base for my first WPF application ready to go, so I compiled a release version of software and tried to run it from the .exe instead of directly from Visual Studio. I was promptly greeted with the following error:
The tag ‘WindowsFormsHost’ does not exist in XML namespace ‘http://schemas.microsoft.com/winfx/2006/xaml/presentation’.
It ran flawlessly from the Visual Studio .NET debugger, which I found a bit odd. I tracked the issue back to the following problem. When I originally referenced the WindowsFormsIntegration.DLL from my project, the “Copy Local” option was set to false. When I went back in and set that value to True, the application promptly broke when it ran in the debugger. I don’t mind when things break as long as they break consistently, so this was a step in the right direction. I had found a few helpful forum entries informing me that you have to specify the xml namespace for the WindowsFormsIntegration assembly. So I added the following xmlns entry:
xmlns:wfi=”clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration”
And changed my WindowsFormsIntegration tag from
<WindowsFormsHost>
…
</WindowsFormsHost>
to
<wfi:WindowsFormsHost>
…
</wfi:WindowsFormsHost>
and it started working just fine.
Load comments