ASP.NET Core WebApp 在 Travis CI 上无法构建

4
在构建ASP.NET Core WebApp时,在TravisCI上遇到以下错误:TravisCI

找不到项目文件 /usr/lib/mono/xbuild/Microsoft/VisualStudio/v14.0/DotNet/Microsoft.DotNet.Props ,无法导入。忽略。

AppVeyor上的构建是正常的。有没有办法安装缺失的文件?
请注意,我对Travis CI比较新,请提供参考(例如链接/步骤/指南)以实现您的建议,谢谢。
1个回答

3
经过试验和错误,我们得出了以下结论:

我没有找到任何相关文档,所以如果它不能满足您的需求,您可以自行安装dotnet并使用命令完成您想要的操作(例如dotnet publish)。

旧答案:

If you don't solve the problem with xbuild, you can try using dotnet cli. The install script for RTM is here: https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.sh

Then you use dotnet restore and dotnet build (cd to directory with project.json)

Change your .travis.yml to this:

language: csharp
install: curl -s https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.sh

| bash script: - dotnet restore WebApp/src/WebApp/project.json - dotnet build WebApp/src/WebApp/project.json addons:
apt: packages: - gettext - libcurl4-openssl-dev - libicu-dev - libssl-dev - libunwind8 - zlib1g

I'm not sure all of the apt packages are necessary. source: http://andrewlock.net/adding-travis-ci-to-a-net-core-app/

It's also possible to use KoreBuild https://github.com/aspnet/KoreBuild/tree/1.0.0/template

script: ./build.sh  //Add the file to repo

1
看起来C#的构建是由Travis社区驱动的,并且使用Mono完成。经过一些挖掘:Mono正在开发dotnet集成 - http://www.mono-project.com/docs/about-mono/dotnet-integration/ - Petre T
@PetreTurcu 我刚试了一下KoreBuild,它似乎是最好的解决方案。 - J2ghz
抱歉,我需要在build.sh中做出改变吗?只是复制并修改.yml确实可以通过travis,但无法构建我的解决方案(删除了一个冒号进行测试)。 - Petre T
1
你只是在更改权限。你需要: script: chmod a+x ./build.sh && ./build.sh - J2ghz
尝试添加 addons: apt: packages: - libunwind8(格式如答案所示,注释不能有换行符) - J2ghz
显示剩余3条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接