Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET UpdatePanel library reference errors

I am having a problem with VS 2010 apparently losing it's ability to load an UpdatePanel in the middle of development and it is driving me crazy. I am using VS2010 and building a user control with .NET 3.5, targeting DNN 5.x.

I have created a control to be used on a DNN website that utilizes an update panel. When I develop the control by FTPing to the website and developing on it, everything works just fine. I decided to move development to a local copy of DNN and create a web application project for the control. Everything was working just fine at first. After a few builds, I started to receive the following errors:

The type or namespace name 'UpdateProgress' does not exist in the namespace 'System.Web.UI.WebControls.WebParts' (are you missing an assembly reference?)

The type or namespace name 'UpdatePanel' does not exist in the namespace 'System.Web.UI.WebControls.WebParts' (are you missing an assembly reference?)

I figured I had messed something up along the way and screwed up a reference to the libraries, so I unloaded everything and reloaded the library references. I continued to get the error and could not compile the control. Finally, I decided to redo the entire project and import the code I had already written. Everything was working just fine until a few builds later when the same error popped up.

I followed all of the same steps, unloading the references, reloading them, and finally deleting the project. Each time I create a new project, and copy the exact same code into the .ascx files, they work just fine...for a few builds. Last night, I compiled the library and tested the changes. Everything was great so I closed the project and turned off the machine. Turned it on this morning and received the build errors. It is like I have a ticking timebomb in my computer that just shuts these things off.

Any ideas on what I am missing that might be causing this? I don't know why a library would flicker on and off like this. I have yet to run into this sort of a problem with any other project on my local machine and I really don't want to develop this through FTPing to the website, again. Bleh!

like image 999
Jim D'Angelo Avatar asked Aug 17 '10 13:08

Jim D'Angelo


2 Answers

My solution got into this weird state too. It occurred after editing conflicts in the web-config after getting latest using AnkhSVN. The error only showed in the page I had open in Visual Studio at the time. It said it could no longer locate the UpdatePanel or UpdateProgress in System.Web.UI, which didn't make sense because I use these controls in my other pages.

The Fix:
Simply drag and drop an UpdatePanel from the toolbox onto the page throwing the error. Clean and Rebuild and you're good to go. All you have left to do is remove the UpdatePanel you just added.
I believe doing this re-wires things in the solution that I couldn't see.

like image 152
MikeTeeVee Avatar answered Sep 28 '22 17:09

MikeTeeVee


If you will examine the new web.config file you will find the following (or something close) was added. I was able to add this compiler directive with no other changes and successfully compile. ScriptManager is in the older version of the extensions .dll and needs to be bound. It seems creating a new website will add the compiler directives but upgrading does not.

<!--/system.webServer  positional notes-->;

<runtime>
    <assemblyBinding appliesTo="v2.0.50727" xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
            <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>

<!-- /configuration -->
like image 37
dwhatley Avatar answered Sep 28 '22 17:09

dwhatley