VS 2005 Converted Header causing error when publishing

D

DCC700

VS 2005 Converted Header causing error when publishing

After converting from Visual Studio 2003 to 2005, I have had several
issues with a header that is used throughout the project. The conversion
automatically created an abstract base class for the header in the
Migrated folder of the App_Code directory. One of the major problems
this caused was regarding the fact that I pass the header to a standard
error handling class to process the error and print an appropriate error
message in the header. This results in the following compilation error:

Error 107 Option Strict On disallows narrowing from type 'Header' to
type 'ASP.header_ascx' in copying the value of 'ByRef' parameter
'PageHeader' back to the matching argument.

So to get around this I cast the object to the ASP.header_ascx type it
is looking for and this allows it to build and run correctly. The
header_ascx refers to my header.ascx file, although I'm not sure how
this type ends up under the ASP namespace. Anyway, when I try to publish
the website, which I need to do to create the dll(s) necessary for
deploying I receive a build error for certain pages, ASP.header_ascx
type not found. It is odd that I receive this error when building to
publish but not when just building. If I take out the CType conversion
for certain pages the error seems to go away and builds fine, but if I
try taking it away for all pages then I receive the first error again.

Publishing error: Error 1 Type 'ASP.header_ascx' is not defined.

I have a smaller project that uses a similar header, where the
conversion created the stub the same way, but I have been able to get it
to build/publish correctly without casting the Header. (Although I did
run into the same problems originally)

I cannot find any differences between the way I have the pages
configured in the small project and in the larger one. And in the larger
project I cannot see any differences between the way the pages are
configured, where it can find ASP.header_ascx and those it cant

Has anyone run into similar problems/have any suggestions?
 
D

DCC700

One other thing I did in the smaller project was change the name of
Header.ascx to PHeader.ascx with a class name of PHeader and the base
class name to Page_Header just in case the name Header was being
confused with Header in a different namespace.

I attempted the same thing on the bigger project, but am still having
the same problem.
- If I cast header references to ASP.pheader_ascx then it builds, but on
publish it gives a error: Type 'ASP.pheader_ascx' is not defined. for
certain pages.
- If I remove the cast for the pages that have this error I get the
error for other pages, and if I remove for these I get the error for
other pages stil and so on.
- If I remove the cast for all pages I get build errors for certain
pages like: Option Strict On disallows narrowing from type 'Page_Header'
to type 'ASP.pheader_ascx' in copying the value of 'ByRef' parameter
'PageHeader' back to the matching argument.
- If I place the cast back in for pages with these errors I get the
errors on other pages and so on.

Obviously I have a circular problem, but I am having a hard time
tracking down the root of it.

Any thoughts???
 
D

DCC700

I turned Option Strict Off to see if I could get it to work this way,
which opened up a few more errors which weren't showing before. Once
these errors were resolved, I was able to both build and publish
successfully. Unfortunately when I turn Option Strict back on I receive
the type not found errors again. It is desired for this web project to
have Option Strict setting on. Any suggestions?
 

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