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 reloa开发者_开发问答ded 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!
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.
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 -->
I had the same issue in all my old Projects after updating to Framework 4.0. I tried many times researching why this was happening and nothing I found would work. My team spent over a year living with manually updating the designer.vb
for UpdatePanel to have the right reference every time we changed the ASPX.
The issue happened to be in the project file's reference to AjaxControlToolkit. The reference in the .vbproj
file was version specific for 3.5. So just updating the DLL didn't update the reference. The solution was to remove the AjaxControlToolkit reference, save the project, and then add back the reference to AjaxControlToolkit.dll
.
If you opened the project file in a text editor, you may have seen something like this:
<Reference Include="AjaxControlToolkit, Version=3.5.60623.0, Culture=neutral,
PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL>
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\AjaxControlToolkit.dll</HintPath>
</Reference>
If you did everything right it should look like this:
<Reference Include="AjaxControlToolkit">
<HintPath>bin\AjaxControlToolkit.dll</HintPath>
</Reference>
精彩评论