Project wide Import Alias

  • Thread starter Thread starter Yair Cohen
  • Start date Start date
Y

Yair Cohen

Yes, ther is a way.
in Project->properties, u have an option (in the treeview left side) call
"Imports" (down to "Build").
there u can set global import for the project
(like u was type it on all assemblies separatly)

h.i.h
Yair
 
Is there any way to create an import alias that applies
to the entire project? For example, lets say that I
want "VB" to represent Microsoft.VisualBasic throughout
my entire project. Is there any way to do this without
adding "Imports VB = Microsoft.VisualBasic" to the top of
each file in the project?

Thanks.
 
Hi Lance,

That's an interesting idea but I think the answer's no. There's precious
little systax for playing with namespaces. Maybe someone'll contradict me and
teach us both something ? :-)

If you want this facility because it's a pain in the bum having to enter
one or more aliases for all your projects, you could write macros to get the
IDE to insert them when you create a new Form, Class, Module, etc.

Regards,
Fergus
 
Hi Yair,

I was going to shout Hurray!! but when I tried to use an alias, it didn't
work. :-(

Regards,
Fergus
 
Hi Lance,

I think you can not achieve your aim in the The Imports, Common Properties,
<Projectname> Property Pages Dialog Box.
The Imports, Common Properties, <Projectname> Property Pages Dialog Box is
used to Specifies the namespaces to import for the project. The imports you
specify in this dialog box are passed directly to the compiler (/imports)
and apply to all files in your project.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/ht
ml/vxurfimportstab-projectpropertiespage.asp

While the /imports can not accept an alias.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/
valrfImportImportNamespaceFromSpecifiedAssembly.asp

You may try to access the Imports Object programmatically.
Here is a sample link.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vxlrfvslangprojimports.asp

If you have any related question, please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "Lance" <[email protected]>
Sender: "Lance" <[email protected]>
References: <[email protected]>
<[email protected]>
 
Great links. Thank you!

-----Original Message-----
Hi Lance,

I think you can not achieve your aim in the The Imports, Common Properties,
<Projectname> Property Pages Dialog Box.
The Imports, Common Properties, <Projectname> Property Pages Dialog Box is
used to Specifies the namespaces to import for the project. The imports you
specify in this dialog box are passed directly to the compiler (/imports)
and apply to all files in your project.
http://msdn.microsoft.com/library/default.asp? url=/library/en-us/vsintro7/ht
ml/vxurfimportstab-projectpropertiespage.asp

While the /imports can not accept an alias.
http://msdn.microsoft.com/library/default.asp? url=/library/en-us/vblr7/html/
valrfImportImportNamespaceFromSpecifiedAssembly.asp

You may try to access the Imports Object programmatically.
Here is a sample link.
http://msdn.microsoft.com/library/default.asp? url=/library/en-us/vbcon/html/
vxlrfvslangprojimports.asp

If you have any related question, please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
<[email protected]>


.
 
Back
Top