Error in Control

I created a VB.Net 2005 Control which uses my custom namespace.

imports Name.Division.Cube

<System.Drawing.ToolboxBitmap("UserControl.bmp")> _
<Serializable()> Public Class UserControl
Inherits System.Windows.Forms.UserControl
Implements IExtenderProvider
...
End Class

The control works and compiles. The issue that I am facing is when I start a new project, and add the control to the project, it does not include the namespace "Name.Division.Cube" automatically as a reference. I have to physically add it.

Is there a way where all the necessary namespaces are added to new projects as references when a custom control is added.

Thanks
[727 byte] By [Kountree] at [2007-11-20 10:27:19]
# 1 Re: Error in Control
You are confused. Adding a reference to a project has nothing whatsoever to do with namespaces. You add a reference to an assembly. When you add an instance of your control to a form it will automatically add a reference to your assembly to the project. If it didn't then your control could not be used.

Importing a namespace is something else entirely. The reason you import a namespace is so that you can use the members it contains without having to qualify them in code. Note that one assembly can contain members of as many different namespaces as you like, and members of one namepsace can be declared in as many different assemblies as you like. There is no specific connection between assemblies and namespaces at all.

What you're asking for just doesn't happen with any types, whether third-party or part of the .NET Framework itself. There are various reasons why it shouldn't be so but I'm not going to go into them. Suffice it to say that what you're asking for is not reasonable and won't happen. You can either create your own project template that already has the reference and namespace import you want or else continue to add the imports manually. Given that it takes about half a dozen mouse clicks and about two seconds to add it manually, I don't think it's a big stretch.
jmcilhinney at 2007-11-10 3:08:36 >