Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBUILD 4.0 Fails on AJAX Extensions

We have a .Net 2.0 web app and are converting the solution and projects to Visual Studio 2010 (they were Visual Studio 2005). We are leaving the project targeting Framework 2.0. The app includes Ajax extensions. We did the conversion and can build the project successfully on the server using Visual Studio. However, when we attempt to build the project through MSBUILD 4.0, we get errors on pages where ajax controls are used, such as the following:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3267: The primary reference "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". [C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". [C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "AjaxControlToolkit, Version=1.0.10618.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "AjaxControlToolkit, Version=1.0.10618.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". [C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3267: The primary reference "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". [C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3268: The primary reference "AjaxControlToolkit, Version=1.0.10618.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "AjaxControlToolkit, Version=1.0.10618.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". [C:\Inetpub\wwwroot\gmrcwebsite\GMRCWebsite.vbproj]

...

error BC30451: 'ScriptManager' is not declared. It may be inaccessible due to its protection level. error BC30002: Type 'System.Web.UI.ScriptManager' is not defined. error BC30002: Type 'System.Web.UI.UpdatePanel' is not defined. error BC30002: Type 'System.Web.UI.UpdateProgress' is not defined.

This stuff worked fine before and builds and works fine when built through Visual Studio. What do we need to do to fix these errors?

like image 346
Bo Schatzberg Avatar asked Jun 03 '10 14:06

Bo Schatzberg


2 Answers

I just had the same problem myself after configuring TFS Build service 2008 to use MSBuild 4.0. Everything worked before converting the projects, after then conversion to 2010 format and the switch to MSBuild 4 suddenly it couldn't find the 1.0.61025.0 AJAX libraries.

It turned out there was a registry key missing that pointed to the install location of MS Ajax extensions.

On my dev box the key that should be located at (64-bit OS)

HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ASP.NET AJAX Extensions

was instead placed in HKEY_CURRENT_USER. (32-bit OS: remove the Wow6432Node part)

On the build server the key was missing completely (none of the locally present user profiles had it in its registry hive).

The default value of this key should point to the MS Ajax Extensions installation directory, which in my case is

C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025

After recreating the key on the build server, our solution builds successfully under MSBuild 4.

It remains a mystery to me why it built successfully until now (under MSBuild 3.5). Perhaps the assembly search algorithm changed slightly and is now more restrictive.

Hope that helps.

like image 124
Jakub Berezanski Avatar answered Dec 22 '22 14:12

Jakub Berezanski


Hello here you'll find the solution: http://www.developerit.com/2010/04/19/ms-ajax-libraries-and-configured-assemblies

like image 35
Leszek Wachowicz Avatar answered Dec 22 '22 14:12

Leszek Wachowicz