【发布时间】:2015-06-26 17:20:28
【问题描述】:
(有点相关issue)
TravisCI 支持 C# 构建和 Elastic Beanstalk 部署。凉爽的。但我无法获取 Package 目标来构建部署到 EBS IIS 中的 zip 文件。
我的 .travis.yml 文件如下所示:
language: csharp
solution: RestfulWCFService.sln
mono:
- latest
script:
- xbuild RestfulWCFService.sln /p:Configuration=Release /p:Platform="Any CPU" ## OK
- xbuild RestfulWCFService.csproj /t:Package /p:Configuration=Release ## FAIL!
deploy:
- provider: elasticbeanstalk
....
单声道版:
$ mono --version
Mono JIT compiler version 4.0.1 (tarball Thu May 28 09:08:28 UTC 2015)
(OK)构建消息是:
...
Done executing task "CallTarget"
Done building target "Build" in project "/home/vagrant/syllabus/RestfulWCFService.sln".
Done building target "Build" in project "/home/vagrant/syllabus/RestfulWCFService.sln" ("/home/vagrant/syllabus/RestfulWCFService.sln").
Done building project "/home/vagrant/syllabus/RestfulWCFService.sln".
Build succeeded.
Warnings:
/home/vagrant/syllabus/RestfulWCFService.sln (default targets) ->
(Build target) ->
/home/vagrant/syllabus/RestfulWCFService.csproj (default targets) ->
/usr/lib/mono/4.5/Microsoft.Common.targets (ResolveAssemblyReferences target) ->
/usr/lib/mono/4.5/Microsoft.Common.targets: warning : Reference 'System.Web.Entity' not resolved
1 Warning(s)
0 Error(s)
(FAIL) /t:Package 消息如下所示:
...
/home/vagrant/syllabus/RestfulWCFService.csproj: Importing project /usr/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets from extension path /usr/lib/mono/xbuild
Building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
Done building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
/home/vagrant/syllabus/RestfulWCFService.csproj: error : Target named 'Package' not found in the project.
Done building project "/home/vagrant/syllabus/RestfulWCFService.csproj".-- FAILED
Build FAILED.
Errors:
/home/vagrant/syllabus/RestfulWCFService.csproj (Package) ->
/home/vagrant/syllabus/RestfulWCFService.csproj: error : Target named 'Package' not found in the project.
0 Warning(s)
1 Error(s)
所以我的问题是,为什么是Target named 'Package' not found in the project?我已经验证 /t:Package 在 Windows 机器上可以与 MSBuild 一起正常工作。
注意:我发现如果我在 .csproj 文件中添加一个空目标,例如
[Target Name="Package"\]
[/Target]
它不再抱怨缺少目标,但什么也不做:
...
/home/vagrant/syllabus/RestfulWCFService.csproj: Importing project /usr/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets from extension path /usr/lib/mono/xbuild
Building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
Done building target "_ValidateEssentialProperties" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/usr/lib/mono/4.5/Microsoft.Common.targets").
Building target "Package" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/home/vagrant/syllabus/RestfulWCFService.csproj").
Done building target "Package" in project "/home/vagrant/syllabus/RestfulWCFService.csproj" ("/home/vagrant/syllabus/RestfulWCFService.csproj").
Done building project "/home/vagrant/syllabus/RestfulWCFService.csproj".
Build succeeded.
0 Warning(s)
0 Error(s)
任何 xbuild 帮助将不胜感激。
【问题讨论】:
标签: c# msbuild mono travis-ci xbuild