VS.NET and PPC Custom Controls
From: Derrick (derrick_dunne_at_hotmail.com)
Date: 06/28/04
- Next message: Gernot Frisch: "Re: What eVc++ to use?"
- Previous message: Gernot Frisch: "Re: What eVc++ to use?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Jun 2004 09:15:38 -0230
My project is a set of custom controls for the Compact Framework. Some of
my controls implement an interface that I created; this interface and the
control implementation live in seperate assemblies. My problem is that when
I try to edit one of the properties of my control in a custom UITypeEditor,
I've been getting an "Invalid Cast Exception"
As I'm sure you are all aware, controls for the Compact Framework require
having 2 "mirrored" projects; one full-framework version for design time,
and one strictly compact framework for runtime. Because of this, I have the
interface, implementation (the control itself), and UITypeEditor (this is
where the cast from an Object datatype to the interface type actually
occurs, and the exception is thrown) all in separate DLLs. I have them all
building into the same directory (say, "\Build"). I verfied that the object
in the driver is actually the right type.
What is happening is that when I add my controls to the toolbox in VS.NET
2003 in a test application, a reference to the interface DLL (taken from the
\Build directory) is added to the test project - this is expected behaviour.
I noticed that a property of the control (the definition of this property is
in the same DLL as the interface) is disabled unless I place a copy of the
interface DLL into the C:\Program Files\Microsoft Visual Studio .NET
2003\Common7\IDE\ directory (I figured this out using Filemon). This leaves
me with multiple definitions of the interface (one from the \Build, as
referenced by the test project, and one from that VS.NET directory, which I
have no idea why it is required), so now I understand why I am getting the
Invalid Cast exception when the UITypeEditor is run.
If I change my output directory from \Build to the VS.NET directory (and
change the references accordingly), I no longer get the exception - because
there is no DLL duplication. Ugly, yes; but it works.
Does anyone know why it requires the DLL in that VS.NET directory? That is
the only directory that VS.NET scans looking for that DLL - not the \BUILD
directory at all. I verified this using Filemon as well.
Thanks for any input you may have,
Derrick
- Next message: Gernot Frisch: "Re: What eVc++ to use?"
- Previous message: Gernot Frisch: "Re: What eVc++ to use?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|