【问题标题】:msbuild command not found in travis-ci在 travis-ci 中找不到 msbuild 命令
【发布时间】:2019-11-05 06:38:48
【问题描述】:

我有以下 travis 文件:

language: csharp
solution: src/LaraUI.sln
mono: none
dotnet: 3.0.100

before_install:
 - sudo apt install nuget

install:
 - nuget restore src/LaraUI.sln

script:
 - msbuild /p:Configuration=Debug src/LaraUI.sln
 - dotnet test src/Test/Tests.csproj

这给出了一个错误,提示找不到 msbuild:

msbuild: command not found

我看到的所有示例都不需要安装任何东西,msbuild/nuget 就可以工作。如果我删除了安装 nuget 的行,则会收到类似的 nuget not found 错误。

为了执行 msbuild,我有什么遗漏吗?有办法安装吗?

仓库是here

【问题讨论】:

    标签: c# msbuild nuget travis-ci


    【解决方案1】:

    您应该尝试使用dotnet build 而不是 msbuild。它应该做同样的事情。这里https://docs.microsoft.com/de-de/dotnet/core/tools/dotnet-build

    【讨论】:

    • 遗憾的是 dotnet build 不适用于 NodeJS 项目,只能运行 msbuild
    • @cat_in_hat 抱歉这么晚才回复,我才看到你的评论。幸运的是,dotnet 提供了一种使用 dotnet build 执行 npm 命令的方法。看看这个例子<Target Name="client-app" BeforeTargets="ComputeFilesToPublish"> <Exec Command="npm install" WorkingDirectory="client-app"></Exec> <Exec Command="npm run build" WorkingDirectory="client-app"></Exec> </Target>如果你把它添加到你的csproj它应该在构建时执行这些命令。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-16
    • 2019-10-29
    • 2014-04-21
    • 2022-01-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多