[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.buildingcontrols

Compile & Build works, but publish fails

Paul

6/11/2008 4:05:00 PM

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
3 Answers

stcheng

6/12/2008 3:59:00 AM

0

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/w70...

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

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:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
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/subscriptions/support/de....
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?UGF1bA==?= <vis@nospam.nospam>
>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
>

Paul

6/12/2008 9:20:00 AM

0

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/w70...
>
> #How to Programtically Include ASP.Net User Controls
> http://www.netomatix.com/development/usercont...
>
> 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:
> msdnmg@microsoft.com.
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default....
> 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/subscriptions/support/de....
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --------------------
> >From: =?Utf-8?B?UGF1bA==?= <vis@nospam.nospam>
> >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
> >
>
>

stcheng

6/12/2008 10:15:00 AM

0

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:
msdnmg@microsoft.com.

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


--------------------
>From: =?Utf-8?B?UGF1bA==?= <vis@nospam.nospam>
>References: <54E17485-0CB7-414D-ACDE-B1576EECE5CA@microsoft.com>
<Vp9IsCEzIHA.5796@TK2MSFTNGHUB02.phx.gbl>
>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,
>>