Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ASPXs recompiling, not using the DLL
Message
De
17/03/2003 15:32:45
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
 
À
17/03/2003 07:34:05
Rex Mahel
Realm Software, Llc
Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00765974
Message ID:
00766701
Vues:
27
Rex,

I'm not familiar with a "project level import". I assume you are talking about the Project References. In addition to the Project Reference, you have to either:

1. Add the Imports statement at the top of each .vb file, or
2. Use the fully qualified class name in your Dim statements

Assume that you have compiled RexClass.dll which contains a class called CustomControl1 and you have added it to your project references. (.NET will automatically add the reference when you drop a custom control from your DLL onto a form.):
Public Class CustomControl1
    Inherits System.Web.UI.WebControls.TextBox

End Class
Once the reference to RexClass.dll is added to the project, the following two code blocks are functionally equivalent:
Dim myObject as RexClass.CustomControl1
and
Imports RexClass
Dim myObject as CustomControl1
Remember that the Imports statement is really a compiler directive that instructs .NET to look up class names in the appropriate DLLs when compiling your project.

>Keith,
>
>I have all my Imports at the project level, not page by page, but when I try to run the app, the app level Imports are ignored and the pages try to compile again and cannot find the components that are contained in the Imports. Is the application expecting the .DLL to be in a particular location?
>
>Thanks
>
>Rex
>
>
>>Rex,
>>
>>Your question is a little unclear. The Imports command notifies .NET that you are using a particular namespace. It's a little bit like using a WITH...END WITH block to avoid re-typing the complete specification on each object reference. If you are missing Imports commands in your code file, you will see Intellisense errors on the Dim statements (red squiggly underline). If this is the case, add an Imports command that specifies the namespace you created in your DLL.
>>
>>If your project does not have the proper reference that points to your DLL, you will see Intellisense errors on the Imports command. If you have this error, add a reference to your DLL to the project.
>>
>>If one of your classes shares a name with a .NET built-in class, you will have to use the complete namespace of your DLL when creating objects based on the DLL.
Dim newObject as new RexNamespace.RexClass()
instead of
>>
Imports RexNamespace
>>Dim newObject as new RexClass()
>>
>>Once you have the reference and the Imports command in your code file, .NET will use your DLL anytime you create an object based on the classes in your DLL.
>>
>>>All,
>>>
>>>In my VB.Net application I have removed all the Imports and added them to the project. When I run the application, I keep getting compilation errors saying that the Imports are not there. If I use the project imports, and compile the solution, how do I tell the pages to use the created DLL?
>>>
>>>Thanks
>>>
>>>Rex
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform