简体   繁体   English

TFS 2012 Microsoft.WebApplication.targets

[英]TFS 2012 Microsoft.WebApplication.targets

Environment: TFS 2012 build agent running on a Windows Server 2012 VM.环境:在 Windows Server 2012 VM 上运行的 TFS 2012 构建代理。 .Net 4.0/.Net 4.5 installed. .Net 4.0/.Net 4.5 已安装。 The Windows SDK ( http://msdn.microsoft.com/en-us/library/ms717422.aspx ) has also been installed. Windows SDK ( http://msdn.microsoft.com/en-us/library/ms717422.aspx ) 也已安装。

Issue: The build agent cannot build .net 4.0 web applications developed using VS 2012.问题:构建代理无法构建使用 VS 2012 开发的 .net 4.0 Web 应用程序。

The build fails because it cannot resolve the web targets:构建失败,因为它无法解析 Web 目标:

Error The imported project "C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v11.0\\WebApplications\\Microsoft.WebApplication.targets" was not found.错误 未找到导入的项目“C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v11.0\\WebApplications\\Microsoft.WebApplication.targets”。 Confirm that the path in the declaration is correct, and that the file exists on disk.确认声明中的路径正确,并且该文件存在于磁盘上。

Additional warnings then follow: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found.随后出现其他警告:未找到框架“.NETFramework,Version=v4.0”的参考程序集。 To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed.要解决此问题,请为此框架版本安装 SDK 或 Targeting Pack,或者将您的应用程序重新定位到安装了 SDK 或 Targeting Pack 的框架版本。 Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies.请注意,程序集将从全局程序集缓存 (GAC) 中解析,并将用于代替引用程序集。 Therefore your assembly may not be correctly targeted for the framework you intend.因此,您的程序集可能没有正确针对您想要的框架。

I searched for .NET 4.0 targeting packs here:我在这里搜索了 .NET 4.0 目标包:

http://msdn.microsoft.com/en-US/hh487283.aspx http://msdn.microsoft.com/en-US/hh487283.aspx

but Windows Server 2012 is not listed as a supported platform.但 Windows Server 2012 未列为受支持的平台。

The IT infrastructure team are not keen on installing VS on each build agent VM just to get a targeting pack. IT 基础架构团队并不热衷于在每个构建代理 VM 上安装 VS,只是为了获得目标包。

Does anyone have any ideas as to how I might resolve this?有没有人对我如何解决这个问题有任何想法?

Disclaimer免责声明

I realise the solution I mention below is frowned upon by alot of dev ops people, but in my experience it it by far the simplest and most reliable way to solve the issue.我意识到我在下面提到的解决方案遭到了很多开发运营人员的反对,但根据我的经验,它是迄今为止解决问题的最简单、最可靠的方法。

Solution解决方案

By far the easiest solution to this issue is to install Visual Studio 2012 on your build server.到目前为止,解决此问题的最简单方法是在构建服务器上安装Visual Studio 2012 I know you've said that the infrastructure team are not keen to do it, but IMO it's a best practice.我知道你说过基础设施团队并不热衷于这样做,但 IMO 是最佳实践。 I'll try to outline why below.我将尝试在下面概述原因。

Installing Visual Studio on your build server seems like a strange thing to do, but having been around the TFS block a bit, I have found it to be the simplest way to manage build servers.在您的构建服务器上安装 Visual Studio 似乎是一件奇怪的事情,但在稍微了解了TFS块之后,我发现它是管理构建服务器的最简单方法。

You can copy the files (targets) manually from your dev machine to your build server, but if an update to visual studio comes out, you will need to figure out what has changed and make sure you update all those files too.您可以手动将文件(目标)从您的开发机器复制到您的构建服务器,但是如果 Visual Studio 的更新出现,您将需要弄清楚发生了什么变化并确保您也更新了所有这些文件。 These files typically include Targets files and associated dlls.这些文件通常包括目标文件和关联的 dll。

Also with all the extensions and packages that are available now, it is just easier to load Visual Studio on your build server and install the required packages than try to work out what is needed to replicate the functionality.此外,对于现在可用的所有扩展和包,在构建服务器上加载 Visual Studio 并安装所需的包比尝试计算复制功能所需的内容更容易。

This was made very clear to me recently when Microsoft released ASP.Net and Web Tools 2012.2 .最近,当 Microsoft 发布ASP.Net and Web Tools 2012.2时,这对我来说非常清楚。 This altered the publishing pipeline for Web Sites and Web Projects and I needed to use this in my TFS build.这改变了网站和 Web 项目的发布管道,我需要在我的 TFS 构建中使用它。 It was so much easier to just be able to log onto my build server, load Visual Studio and download the new update.能够登录到我的构建服务器、加载 Visual Studio 并下载新的更新要容易得多。

I would definitely support installing Visual Studio on your build server.我绝对支持在您的构建服务器上安装 Visual Studio。

Is your web app written with asp.net mvc?您的 Web 应用程序是用 asp.net mvc 编写的吗? In that case you probably need to install asp.net mvc on the build machine.在这种情况下,您可能需要在构建机器上安装asp.net mvc I have the same problem with build agent running on a completely clean machine.我在完全干净的机器上运行构建代理时遇到了同样的问题。 After installing that package the build agent managed to build an application.安装该软件包后,构建代理设法构建了一个应用程序。

Hope that helps.希望有帮助。

it was sad to have to install visual studio 2012 on build server in order to run TFS 2012 correctly.这是可悲不得不以运行TFS 2012正确生成服务器上安装Visual Studio 2012。 It means that those features ("C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v11.0\\WebApplications\\Microsoft.WebApplication.targets ....) are missed in the packaging of TFS 2012. Thank Microsoft to modify the package ;-).这意味着 TFS 2012 的包装中缺少这些功能(“C:\\Program Files (x86)\\MSBuild\\Microsoft\\VisualStudio\\v11.0\\WebApplications\\Microsoft.WebApplication.targets ....)。感谢 Microsoft修改包;-)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Microsoft.WebApplication.targets - Microsoft.WebApplication.targets TFS NuGet还原包不起作用 - Microsoft.webapplication.targets - TFS NuGet Restore Package Not Working - Microsoft.webapplication.targets 文件存在时,找不到TFS构建错误“ Microsoft.WebApplication.targets”。有时构建成功 - TFS build Error Microsoft.WebApplication.targets" was not found, while file exists. Sometimes build is success 错误MSB4019:找不到Microsoft.WebApplication.targets - error MSB4019: Microsoft.WebApplication.targets" was not found TFS在线构建错误:尝试构建VS2008应用程序时找不到“ WebApplication.targets” - TFS Online build error: WebApplication.targets" was not found trying to build a VS2008 app TFS托管构建控制器 - 找不到Microsoft.TextTemplating.targets - TFS Hosted Build Controller - Microsoft.TextTemplating.targets not found Azure 2.6 SDK-在TFS Online上找不到Microsoft.WindowsAzure.targets - Azure 2.6 SDK - Microsoft.WindowsAzure.targets not found on TFS Online Microsoft Database Sync设置了与TFS 2012的持续集成 - Microsoft Database Sync set up Continuous Integration with TFS 2012 使用Visual Studio 2012和C Sharp连接到Microsoft Cloud TFS服务器 - Connect with Visual Studio 2012 and C sharp to microsoft cloud TFS server TFS 2012和SSMS 2012 - TFS 2012 and SSMS 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM