Last post Aug 24, 2009 05:59 PM by Riaz Hosein
Jul 30, 2009 08:35 AM|GemMaddy|LINK
I've come across a weird problem while publishing my website. It builds well normally but when I tried to publish the same website, it referes to a "namespace ASP" and throws error as below:
error CS0234: The type or namespace name 'usercontrols_secure_quotesummary_ascx' does not exist in the namespace 'ASP' (are you missing an assembly reference?)
I've not developed this application from scratch but I found the code causing the problem within the ItemCreated handler of a Repeater which contains a usercontrol UserControls_Secure_QuoteSummary
Control c0 = e.Item.Controls; // the html (literal control)
// wire up the event
Control c1 = e.Item.Controls; // the quotesummary object
if(c1.GetType() == typeof(ASP.usercontrols_secure_quotesummary_ascx))
((ASP.usercontrols_secure_quotesummary_ascx)c1).QuoteSummaryEvent += new CommandEventHandler(OnQuoteSummaryEvent);
I didn't find any reference of namespace ASP in the website. When I try to go to definition of "ASP.usercontrols_secure_quotesummary_ascx", it takes me to temp location where a file is created automatically. Deleting the tem file again create the same file wven if I dont build. code in the file is as follows
public class usercontrols_secure_quotesummary_ascx : UserControls_Secure_QuoteSummary
protected override void FrameworkInitialize();
Can anyone suggest on the above issue as I'm not able to deploy the website?
Aug 04, 2009 09:07 AM|Thomas Sun – MSFT|LINK
The namespace ASP is the root namespace of ASP.NET website by default. We cannot change it. When we precompile it from Visual Studio, aspnet_compiler will add ASP as every page, .aspx or .ascx, root namesapce.
In your case, please try to disable or enable “allow this precompiled site to be updatable” while publishing website.
I look forward to receiving your test results.
Aug 24, 2009 05:59 PM|Riaz Hosein|LINK
I have a related problem where I want to publish my site such that it can be updated on the target. If I check "Allow this precompile site to be updatable", it compiles without issue, but fails when trying to publish with the following error:
"error CS0234: The type or namespace name 'some_user_control_ascx' does not exist in the namespace 'ASP' (are you missing an assembly reference?)"
The source code is as follows:
ASP.some_user_control_ascx categoryRow = (ASP.some_user_control_ascx)e.Item.FindControl("SomeUserControl");
Note that the site publishes without issue when "Allow this precompile site to be updatable" is unchecked (i.e. the site is no longer updatable).
Previously, we simply copy the source files to the target as part of the deployment, but we've recently started using Team Foundation Server and its automated build feature. The only way I got it to automatically build is by unchecking "Allow this precompile
site to be updatable". But of course now the site cannot be updated once deployed.
Any idea how to publish the site as updatable without getting that error ?