473,396 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Command Line Compilation - Inherits

If I use the following in my code behind page:

Public Class _Default
Inherits System.Web.UI.Page

The page will compile with no errors from the command line compiler
(vbc.exe)

But, If I insert my own base page to inherit from, say,

Public Class _Default
Inherits BaseWebPage

I am unable to get the code to compile, even if I compile BaseWebPage first
and make a reference to it.
Do I have to include the code for BaseWebPage with every page that wants to
inherit it?
I've tried a number of things here, but have been unsuccessful.

Thank you,

Todd
Nov 18 '05 #1
6 1452
Todd A wrote:
If I use the following in my code behind page:

Public Class _Default
Inherits System.Web.UI.Page

The page will compile with no errors from the command line compiler
(vbc.exe)

But, If I insert my own base page to inherit from, say,

Public Class _Default
Inherits BaseWebPage

I am unable to get the code to compile, even if I compile BaseWebPage first
and make a reference to it.
Do I have to include the code for BaseWebPage with every page that wants to
inherit it?
I've tried a number of things here, but have been unsuccessful.


Are you sure that the name of your class is simply "BaseWebPage"?
usually classes - even your custom coded ones - are somewhere in a
namespace hierarchy.

If you're not sure, run ildasm on the assembly that contains the
BaseWebPage class - it'll show you the namespace (if there is one).

Remember that if you're creating your class using VB.NET the namespace
that it will reside in does not have to come from the source file - the
compiler has a command line option "/rootnamespace" which can specify
one. VS.NET VB projects default the rootnamespace to the name of the
project.

--
mikeb
Nov 18 '05 #2
MIke,
Good point.
I am using a response file, and in the file, I specify my namespace with
/rootnamespace:
Here is a real sample:

/target:Library
/out:"C:\Inetpub\wwwroot\stpaulmoms\bin\_Default.dl l"
/rootnamespace:StPaulMoms
/optimize+
/reference:"System.dll","System.Data.dll","System.D rawing.dll","System.Web.d
ll","System.Xml.dll","System.Design.dll","C:\Inetp ub\wwwroot\stpaulmoms\bin\
DAL.dll","C:\Inetpub\wwwroot\stpaulmoms\bin\StPaul MomsMB.dll"
/Imports:Microsoft.VisualBasic,System,System.Collec tions,System.Configuratio
n,System.Data,System.Drawing,System.Web,System.Web .UI,System.Web.UI.HtmlCont
rols,System.Web.UI.WebControls
/res:"C:\Inetpub\wwwroot\stpaulmoms\StPaulMoms.Defa ult.resources"
"C:\Inetpub\wwwroot\stpaulmoms\Default.aspx.vb "

My goal is to give each web page their own DLL. That's why I'm deviating
from the VS.NET Model of building my assemblies.
If my BaseWebPage class (It is named BaseWebPage), which all my web pages
inherit from, is just a stand alone compiled DLL, how can I compile one
class that inherits from a class inside an already compiled dll?

Thanks,
Todd

"mikeb" <ma************@mailnull.com> wrote in message
news:e5**************@TK2MSFTNGP09.phx.gbl...
Todd A wrote:
If I use the following in my code behind page:

Public Class _Default
Inherits System.Web.UI.Page

The page will compile with no errors from the command line compiler
(vbc.exe)

But, If I insert my own base page to inherit from, say,

Public Class _Default
Inherits BaseWebPage

I am unable to get the code to compile, even if I compile BaseWebPage first and make a reference to it.
Do I have to include the code for BaseWebPage with every page that wants to inherit it?
I've tried a number of things here, but have been unsuccessful.


Are you sure that the name of your class is simply "BaseWebPage"?
usually classes - even your custom coded ones - are somewhere in a
namespace hierarchy.

If you're not sure, run ildasm on the assembly that contains the
BaseWebPage class - it'll show you the namespace (if there is one).

Remember that if you're creating your class using VB.NET the namespace
that it will reside in does not have to come from the source file - the
compiler has a command line option "/rootnamespace" which can specify
one. VS.NET VB projects default the rootnamespace to the name of the
project.

--
mikeb

Nov 18 '05 #3
Todd A wrote:
MIke,
Good point.
I am using a response file, and in the file, I specify my namespace with
/rootnamespace:
Here is a real sample:

/target:Library
/out:"C:\Inetpub\wwwroot\stpaulmoms\bin\_Default.dl l"
/rootnamespace:StPaulMoms
/optimize+
/reference:"System.dll","System.Data.dll","System.D rawing.dll","System.Web.d
ll","System.Xml.dll","System.Design.dll","C:\Inetp ub\wwwroot\stpaulmoms\bin\
DAL.dll","C:\Inetpub\wwwroot\stpaulmoms\bin\StPaul MomsMB.dll"
/Imports:Microsoft.VisualBasic,System,System.Collec tions,System.Configuratio
n,System.Data,System.Drawing,System.Web,System.Web .UI,System.Web.UI.HtmlCont
rols,System.Web.UI.WebControls
/res:"C:\Inetpub\wwwroot\stpaulmoms\StPaulMoms.Defa ult.resources"
"C:\Inetpub\wwwroot\stpaulmoms\Default.aspx.vb "
I assume that this is the response file used to compile the codebehind page.

I think what we need to look at is the response file and command line
used to build whatever assembly the BaseWebPage class resides in. I
assume it's either DAL.dll or StPaulMomsMB.dll since those are the only
non-framework assemblies referenced above.

My goal is to give each web page their own DLL. That's why I'm deviating
from the VS.NET Model of building my assemblies.
If my BaseWebPage class (It is named BaseWebPage), which all my web pages
inherit from, is just a stand alone compiled DLL, how can I compile one
class that inherits from a class inside an already compiled dll?

Thanks,
Todd

"mikeb" <ma************@mailnull.com> wrote in message
news:e5**************@TK2MSFTNGP09.phx.gbl...
Todd A wrote:
If I use the following in my code behind page:

Public Class _Default
Inherits System.Web.UI.Page

The page will compile with no errors from the command line compiler
(vbc.exe)

But, If I insert my own base page to inherit from, say,

Public Class _Default
Inherits BaseWebPage

I am unable to get the code to compile, even if I compile BaseWebPage
first
and make a reference to it.
Do I have to include the code for BaseWebPage with every page that wants
to
inherit it?
I've tried a number of things here, but have been unsuccessful.


Are you sure that the name of your class is simply "BaseWebPage"?
usually classes - even your custom coded ones - are somewhere in a
namespace hierarchy.

If you're not sure, run ildasm on the assembly that contains the
BaseWebPage class - it'll show you the namespace (if there is one).

Remember that if you're creating your class using VB.NET the namespace
that it will reside in does not have to come from the source file - the
compiler has a command line option "/rootnamespace" which can specify
one. VS.NET VB projects default the rootnamespace to the name of the
project.

--
mikeb


--
mikeb
Nov 18 '05 #4
Thanks Mike,
That did the trick.

I've been away from technology for awhile, so this response is late.

Here's one more question if you have time:

What about vb files that are just MODULES and not classes?
Example: abc.dll is an assembly that has nothing but a public module in it.
xyz.dll fails on compilation when code in xyz is referencing code in abc.
Even though I include the reference to abc.dll when I try to compile
xyz.dll, it fails. Is there something special I should know about
compileing modules and referencing them?

Thanks

Todd
Nov 18 '05 #5
Todd A wrote:
Thanks Mike,
That did the trick.

I've been away from technology for awhile, so this response is late.

Here's one more question if you have time:

What about vb files that are just MODULES and not classes?
Example: abc.dll is an assembly that has nothing but a public module in it.
xyz.dll fails on compilation when code in xyz is referencing code in abc.
Even though I include the reference to abc.dll when I try to compile
xyz.dll, it fails. Is there something special I should know about
compileing modules and referencing them?


I'm not a VB.NET expert, but as far as I know, VB.NET Modules are simply
a way to provide something like global variables and non-class-based
functions.

Members of a module are accessible within a namespace without specifying
the name of the module - you would still have to import the namespace
containing the module (or specify the namespace explicitly).

So if you have a something like:

namespace NS1
public module ModuleX
sub test( s as string)
Console.WriteLine( "Inside NS1.ModuleX.test")
end sub
end module
end namespace

The test() subroutine can be called using any of the following:

NS1.test( "x")
NS1.ModuleX.test( "x")
test("x") ' only if there's an "imports NS1" statement

Remember that even when compiling assemblies that contain VB.NET
Modules, the Module might be a member of a namespace by virtue of a
compiler option - just like when compiling a class.

Personally, I think that the namespace a type resides in should be
specified in the source code and that it is a mistake for the VB.NET
compiler to have that option. But it does, and your build environment
needs to take it into account.

--
mikeb
Nov 18 '05 #6
Thanks again Mike,
After tinkering a bit with what you suggested, I found that my module wasn't
declared Public. If you don't stipulate either Public or Private, the
module will default to Private. This was causing the problem.

That was the last piece to my puzzle. Thanks again.

-Todd

"mikeb" <ma************@mailnull.com> wrote in message
news:Oe*************@tk2msftngp13.phx.gbl...
Todd A wrote:
Thanks Mike,
That did the trick.

I've been away from technology for awhile, so this response is late.

Here's one more question if you have time:

What about vb files that are just MODULES and not classes?
Example: abc.dll is an assembly that has nothing but a public module in it. xyz.dll fails on compilation when code in xyz is referencing code in abc. Even though I include the reference to abc.dll when I try to compile
xyz.dll, it fails. Is there something special I should know about
compileing modules and referencing them?


I'm not a VB.NET expert, but as far as I know, VB.NET Modules are simply
a way to provide something like global variables and non-class-based
functions.

Members of a module are accessible within a namespace without specifying
the name of the module - you would still have to import the namespace
containing the module (or specify the namespace explicitly).

So if you have a something like:

namespace NS1
public module ModuleX
sub test( s as string)
Console.WriteLine( "Inside NS1.ModuleX.test")
end sub
end module
end namespace

The test() subroutine can be called using any of the following:

NS1.test( "x")
NS1.ModuleX.test( "x")
test("x") ' only if there's an "imports NS1" statement

Remember that even when compiling assemblies that contain VB.NET
Modules, the Module might be a member of a namespace by virtue of a
compiler option - just like when compiling a class.

Personally, I think that the namespace a type resides in should be
specified in the source code and that it is a mistake for the VB.NET
compiler to have that option. But it does, and your build environment
needs to take it into account.

--
mikeb

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: aladdin | last post by:
Hi, I wonder what's the difference of compilation between using command line and using VS.NET IDE. For I have a windows service program, there's always a difference between the output file...
1
by: rforman1 | last post by:
I have found many threads with this question asked and ostensibly answered, but none with an example of how exactly to do it. Help! I know that in order to set up the values of command line...
8
by: Peter A. Schott | last post by:
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of...
4
by: kendf | last post by:
Appreciated if someone could tell me how to compile the MS Exception Management Application Block downloaded from MS Official site?
4
by: Francesco Martinelli | last post by:
I need to create a multiple file assemby: this requires working directly with the command line compiler (no IDE support!). After a few tests I found my problem comes from the issue described below....
4
by: Todd Acheson | last post by:
TOOLS: Visual Studio.NET 2003 .NET SDK GOAL: Reproduce the DLL's that our Visual Studio.NET development boxes create, by using the SDK command line compilers DILLEMA: RESX Files, how to...
0
by: Plat | last post by:
Okay, you'll probably think me crazy for asking this. And I am, but also curious; so please humor me. :) I'm wondering if there's a way to - using dynamic (server-side) compilation - include a...
2
by: Enrique Bustamante | last post by:
Casting arrays that works on watch and command window but not in code. My application is casting arrays in a way it should work. To test if I was doing something invalid, I wrote a test code that...
4
by: wxforecaster | last post by:
As alluded to in my post yesterday, I'm trying to compile a common C utility in Windows. It's only reference is to zlib.h, which needs zconf.h and in turn libz.a On Unix I've compiled this with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.