Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Compile & Build works, but publish fails

Reply
Thread Tools

Compile & Build works, but publish fails

 
 
Paul
Guest
Posts: n/a
 
      06-11-2008
Hi,

Loosing hair today.

I have a web site that builds, rebuilds, debugs 100%. No problem. When I run
"Publish" though, it fails. Error in Output is:
"error BC30002: Type 'ASP.controls_questioncontrol_ascx' is not defined."

Now, questioncontrol is a "web user control" that is part of the project.

I have this in the aspx file (it errors on this line)
<%@ Register Src="~/Controls/QuestionControl.ascx" TagName="QuestionControl"
TagPrefix="uc1" %>

I have this in the code behind file (it errors on this line)
Protected WithEvents u_ctrl_DetailedQuestionsPerPage As
ASP.controls_questioncontrol_ascx

Using framework 3.5 VS2008

Any help would be appreciated.
Thanks
Paul
 
Reply With Quote
 
 
 
 
Steven Cheng [MSFT]
Guest
Posts: n/a
 
      06-12-2008
Hi Paul,

From your description, you're encountering the following error when try
publishing (precompile) an ASP.NET 2.0 web site project, correct?

"error BC30002: Type 'ASP.controls_questioncontrol_ascx' is not defined."

Based on my experience, such error is mostly caused by the precompilation
of some page's code file can not resolve a certain type(which is used in
the code). For your scenario, that problem type is a usercontrol's
codebehind class, and you have the following line to use it in a certain
code file:

===================
Protected WithEvents u_ctrl_DetailedQuestionsPerPage As
ASP.controls_questioncontrol_ascx
===================

would you tell me where did you put the above member field, in another aspx
page or ascx control's code behind?

Since ASP.NET 2.0 use dynamic compilation, two different page or
usercontrol are not guaranteed to be compiled into the same assembly. Thus,
if you want to reference the codebehind class type of another aspx page or
ascx usercontrol in a given page's codebehind, you need to add the
"@Reference" directive to explicitly indicate the ASP.NET runtime to
compile them into same assembly. e.g.

=========
<%@ Reference virtualPath="[path to your ascx user control]" %>
==================

#@ Reference
http://msdn.microsoft.com/en-us/library/w70c655a.aspx

#How to Programtically Include ASP.Net User Controls
http://www.netomatix.com/development/usercontrols2.aspx

Please feel free to let me know if there is anything unclear.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?UGF1bA==?= <>
>Subject: Compile & Build works, but publish fails
>Date: Wed, 11 Jun 2008 09:05:01 -0700


>
>Hi,
>
>Loosing hair today.
>
>I have a web site that builds, rebuilds, debugs 100%. No problem. When I

run
>"Publish" though, it fails. Error in Output is:
>"error BC30002: Type 'ASP.controls_questioncontrol_ascx' is not defined."
>
>Now, questioncontrol is a "web user control" that is part of the project.
>
>I have this in the aspx file (it errors on this line)
><%@ Register Src="~/Controls/QuestionControl.ascx"

TagName="QuestionControl"
>TagPrefix="uc1" %>
>
>I have this in the code behind file (it errors on this line)
> Protected WithEvents u_ctrl_DetailedQuestionsPerPage As
>ASP.controls_questioncontrol_ascx
>
>Using framework 3.5 VS2008
>
>Any help would be appreciated.
>Thanks
>Paul
>


 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      06-12-2008
Hi,

Thanks for giving me some ideas.

In the end I only did 2 things:

1. Added the following to the control's directive:
Classname="myControlName"
2. In the asp code behind, I refer to the classname above, not to
asp.mycontrol

Thanks
Paul

"Steven Cheng [MSFT]" wrote:

> Hi Paul,
>
> From your description, you're encountering the following error when try
> publishing (precompile) an ASP.NET 2.0 web site project, correct?
>
> "error BC30002: Type 'ASP.controls_questioncontrol_ascx' is not defined."
>
> Based on my experience, such error is mostly caused by the precompilation
> of some page's code file can not resolve a certain type(which is used in
> the code). For your scenario, that problem type is a usercontrol's
> codebehind class, and you have the following line to use it in a certain
> code file:
>
> ===================
> Protected WithEvents u_ctrl_DetailedQuestionsPerPage As
> ASP.controls_questioncontrol_ascx
> ===================
>
> would you tell me where did you put the above member field, in another aspx
> page or ascx control's code behind?
>
> Since ASP.NET 2.0 use dynamic compilation, two different page or
> usercontrol are not guaranteed to be compiled into the same assembly. Thus,
> if you want to reference the codebehind class type of another aspx page or
> ascx usercontrol in a given page's codebehind, you need to add the
> "@Reference" directive to explicitly indicate the ASP.NET runtime to
> compile them into same assembly. e.g.
>
> =========
> <%@ Reference virtualPath="[path to your ascx user control]" %>
> ==================
>
> #@ Reference
> http://msdn.microsoft.com/en-us/library/w70c655a.aspx
>
> #How to Programtically Include ASP.Net User Controls
> http://www.netomatix.com/development/usercontrols2.aspx
>
> Please feel free to let me know if there is anything unclear.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> .
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscripti...ult.aspx#notif
> ications.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscripti...t/default.aspx.
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --------------------
> >From: =?Utf-8?B?UGF1bA==?= <>
> >Subject: Compile & Build works, but publish fails
> >Date: Wed, 11 Jun 2008 09:05:01 -0700

>
> >
> >Hi,
> >
> >Loosing hair today.
> >
> >I have a web site that builds, rebuilds, debugs 100%. No problem. When I

> run
> >"Publish" though, it fails. Error in Output is:
> >"error BC30002: Type 'ASP.controls_questioncontrol_ascx' is not defined."
> >
> >Now, questioncontrol is a "web user control" that is part of the project.
> >
> >I have this in the aspx file (it errors on this line)
> ><%@ Register Src="~/Controls/QuestionControl.ascx"

> TagName="QuestionControl"
> >TagPrefix="uc1" %>
> >
> >I have this in the code behind file (it errors on this line)
> > Protected WithEvents u_ctrl_DetailedQuestionsPerPage As
> >ASP.controls_questioncontrol_ascx
> >
> >Using framework 3.5 VS2008
> >
> >Any help would be appreciated.
> >Thanks
> >Paul
> >

>
>

 
Reply With Quote
 
Steven Cheng [MSFT]
Guest
Posts: n/a
 
      06-12-2008
Thanks for your reply Paul,

Yes, I think using "ClassName" attribute is a good idea. Actually, that
makes the ASP.NET runtime compile your ascx usercontrol's codebehind class
into the specified type name instead of a augogenarated one. Thus, other
pages reference via the "ClassName" can work correctly without explicitly
use @reference directive.

If you need any further help later, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
=====================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
>From: =?Utf-8?B?UGF1bA==?= <>
>References: <54E17485-0CB7-414D-ACDE->

<>
>Subject: RE: Compile & Build works, but publish fails
>Date: Thu, 12 Jun 2008 02:20:02 -0700


>
>Hi,
>
>Thanks for giving me some ideas.
>
>In the end I only did 2 things:
>
>1. Added the following to the control's directive:
>Classname="myControlName"
>2. In the asp code behind, I refer to the classname above, not to
>asp.mycontrol
>
>Thanks
>Paul
>
>"Steven Cheng [MSFT]" wrote:
>
>> Hi Paul,
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
count_if(somestr.begin(), somestr.end(), isalpha) fails to compile ongcc, but compiles on VS2008 rep_movsd C++ 15 08-17-2009 11:50 AM
Publish Web Site won't publish my doc/docx files Tim Royal ASP .Net 0 08-28-2008 01:42 AM
G++ paste operator - expands as desired but compile fails Chris C++ 4 08-20-2007 09:38 PM
cant compile on linux system.cant compile on cant compile onlinux system. Nagaraj C++ 1 03-01-2007 11:18 AM
SWsoft Acronis Disk Director Suite 9.0 Build 508, Acronis OS Selector 8.0 Build 917, Acronis Partition Expert 2003 Build 292, Acronis Power Utilities 2004 Build 502, F-SECURE.ANTI vIRUS.PROXY v1.10.17.WINALL, F-SECURE.ANTI vIRUS v5.50.10260 for CITRI vvcd Computer Support 0 09-25-2004 01:38 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57