Multiple custom controls with designtime support

P

PeterB

Hi!

I want to create a dll with several controls in it, and all of them should
have design-time support in Visual Studio 2003. I have successfully done the
LabelControl project (downloadable from OpenNetCF Controls forum). I now
tried to add another control to the library, but when I compile I get an
error message saying:

....\MyTestControl\LabelControl2.cs(6,12): error CS0579: Duplicate
'System.CF.Design.RuntimeAssemblyAttribute' attribute

I have named the two controls LabelControl1 and LabelControl2. They both
reside in the same namespace (LabelControls). The RuntimeAssemblyAttribute
is set to:


#if NETCFDESIGNTIME
[assembly: System.CF.Design.RuntimeAssemblyAttribute("LabelControl1,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
#endif

and


#if NETCFDESIGNTIME
[assembly: System.CF.Design.RuntimeAssemblyAttribute("LabelControl2,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
#endif

AssemblyInfo.cs contains the following line:


[assembly: AssemblyVersion("1.0.0.0")]

I run BUILDDES.BAT with the following arguments:
LabelControls.dll LabelControl1.cs LabelControl2.cs

Is this how you compile several controls into one library or must I do it in
another way?

thanks,

Peter
 
P

Peter Foot [MVP]

The runtimeassemblyattribute is defined once per assembly to indicate the
runtime version of the dll to use - the actual control class to use is
inferred from this based on the full namespace and classname. Therefore if
you have multiple controls in an assembly you only have one
RuntimeAssemblyAttribute which references the dll from which the controls
are loaded at runtime. For example the OpenNETCF controls have a designtime
library OpenNETCF.Windows.Forms.Design.dll which contains a single
RuntimeAssemblyAttribute to point to OpenNETCF.Windows.Forms.dll.

You'll probably fnd it most logical to place this attribute in the
AssemblyInfo.cs file along with the other assembly-wide attributes just wrap
it in a #if DESIGN #endif block so it is not built into the runtime version.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
P

PeterB

Thanks Peter!


Peter Foot said:
The runtimeassemblyattribute is defined once per assembly to indicate the
runtime version of the dll to use - the actual control class to use is
inferred from this based on the full namespace and classname. Therefore if
you have multiple controls in an assembly you only have one
RuntimeAssemblyAttribute which references the dll from which the controls
are loaded at runtime. For example the OpenNETCF controls have a designtime
library OpenNETCF.Windows.Forms.Design.dll which contains a single
RuntimeAssemblyAttribute to point to OpenNETCF.Windows.Forms.dll.

You'll probably fnd it most logical to place this attribute in the
AssemblyInfo.cs file along with the other assembly-wide attributes just wrap
it in a #if DESIGN #endif block so it is not built into the runtime version.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups

PeterB said:
Hi!

I want to create a dll with several controls in it, and all of them should
have design-time support in Visual Studio 2003. I have successfully done
the
LabelControl project (downloadable from OpenNetCF Controls forum). I now
tried to add another control to the library, but when I compile I get an
error message saying:

...\MyTestControl\LabelControl2.cs(6,12): error CS0579: Duplicate
'System.CF.Design.RuntimeAssemblyAttribute' attribute

I have named the two controls LabelControl1 and LabelControl2. They both
reside in the same namespace (LabelControls). The RuntimeAssemblyAttribute
is set to:


#if NETCFDESIGNTIME
[assembly: System.CF.Design.RuntimeAssemblyAttribute("LabelControl1,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
#endif

and


#if NETCFDESIGNTIME
[assembly: System.CF.Design.RuntimeAssemblyAttribute("LabelControl2,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null")]
#endif

AssemblyInfo.cs contains the following line:


[assembly: AssemblyVersion("1.0.0.0")]

I run BUILDDES.BAT with the following arguments:
LabelControls.dll LabelControl1.cs LabelControl2.cs

Is this how you compile several controls into one library or must I do it
in
another way?

thanks,

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top