jenkins编译asp.net常见问题

jenkins好像用的蛮广泛的,很多家公司都在用,这里就发一些最近在一台新节点上部署Asp.net网站遇到的问题:

首先来说说环境,除了按照jenkins之外,我们还需要按照 .net 2.0 4.0之类的按照你项目来,我这里是4.0,然后建议安装一个MS SDK,很多东西都能装上,如果没装,可能会出现下面的错误:

error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
error MSB3091: Task failed because "AxImp.exe" was not found, or the correct Microsoft Windows SDK is not installed. The task is looking for "AxImp.exe" in the "bin" subdirectory beneath the location specified in the InstallationFolder value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A. You may be able to solve the problem by doing one of the following:  1) Install the Microsoft Windows SDK.  2) Install Visual Studio 2010.  3) Manually set the above registry key to the correct location.  4) Pass the correct location into the "ToolPath" parameter of the task. [

环境配置差异导致找不到文件:

(GetAspNetMergePath target) -> 
  C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(132,5): error : Can't find the valid AspnetMergePath

 解决方法是找到jenkins部署机器上的真实路径,比如我的是:

C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools

只要将这个路径放在Jenkins的编译指令中就可以了,比如我的:

/t:Rebuild /property:Configuration=Release;PublishProfile=jenkins-DB2Eshang;DeployOnBuild=true;VisualStudioVersion=12.0 /property:TargetFrameworkVersion=v4.5 /p:AspnetMergePath="C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools

猜你喜欢

转载自jingjie520.iteye.com/blog/2234694
今日推荐