visual-studio-2010 - MSBUILD 4.0 在 AJAX 扩展上失败

标签 visual-studio-2010 asp.net-ajax msbuild

我们有一个 .Net 2.0 Web 应用程序,并将解决方案和项目转换为 Visual Studio 2010(它们是 Visual Studio 2005)。我们将离开针对 Framework 2.0 的项目。该应用程序包含 Ajax 扩展。我们完成了转换,并且可以使用 Visual Studio 在服务器上成功构建项目。但是,当我们尝试通过 MSBUILD 4.0 构建项目时,在使用 ajax 控件的页面上会出现错误,如下所示:

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.

这个东西以前工作得很好,通过 Visual Studio 构建时也能正常工作。我们需要做什么来修复这些错误?

最佳答案

在配置 TFS Build service 2008 以使用 MSBuild 4.0 后,我自己也遇到了同样的问题。在转换项目之前一切正常,然后转换为 2010 格式并切换到 MSBuild 4 突然找不到 1.0.61025.0 AJAX 库。

结果发现缺少一个指向 MS Ajax 扩展安装位置的注册表项。

在我的开发盒上, key 应位于(64 位操作系统)

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

被放置在 HKEY_CURRENT_USER 中。 (32位操作系统:删除Wow6432Node部分)

构建服务器上,该 key 完全丢失(本地存在的用户配置文件的注册表配置单元中都没有该 key )。

该键的默认值应该指向 MS Ajax Extensions 安装目录,在我的例子中是

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

在构建服务器上重新创建 key 后,我们的解决方案在 MSBuild 4 下成功构建。

直到现在(在 MSBuild 3.5 下)它为何能够成功构建,对我来说仍然是个谜。也许程序集搜索算法略有变化,现在更具限制性。

希望有帮助。

关于visual-studio-2010 - MSBUILD 4.0 在 AJAX 扩展上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2966769/

相关文章:

visual-studio-2010 - 如何将 C# 语言支持添加到 Visual Studio 2010 shell?

javascript - 从下拉列表中获取过滤后的数据并显示在另一个下拉列表中

c# - 我在回发方面遇到了一个奇怪的问题,它重定向而不是回发

asp.net - UpdatePanel 异步回发后页面丢失标题

.net - 如何在 Jenkins 上为 .net 项目设置构建/部署

c# - 如何为 OpenFileDialog 框中的取消按钮编写代码

silverlight - 错误: unable to start debugging.尚未安装Silverlight开发人员运行时。请安装匹配版本

c# - WPF 线程错误(处理了无效操作异常)

.net - StyleCop 与 CI 构建过程(Cruise Control、Nant、msbuild 和 StyleCop)的集成

c++ - CreateFileA 间歇性返回错误 20、 "The system cannot find the device specified"