Damon Armstrong

Caffeine Induced Tirades about .NET and Life
And don't forget to check out my latest Simple-Talk articles
Add to Technorati Favorites      Add to Google     

WPF: WindowsFormsHost Control Error

Published Tuesday, September 04, 2007 7:39 PM

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.

by Damon

Comments

No Comments
You need to sign in to comment on this blog

















<September 2007>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
Investigating SQL Server 2008 Wait Events with XEVENTS
 Some reasons for the slow-running of database applications aren't obvious. Occasionally, even the... Read more...

Controlling Email Messages using Exchange's Transport Rules
 Some tasks that should have been easy in previous versions of Exchange just weren't. Now, with... Read more...

Software Tool design: The Three Rs
 To understand the full extent of the requirements of your users when you are redesigning a software... Read more...

JSON and other data serialization languages
 The easiest way to speed up an Ajax application is to take out the 'X' and use JSON rather than XML. Of... Read more...

Embedding Help so it will be used
 It is not good enough to make assumptions about the way that users go about getting help when they use... Read more...