Dib
Dib

Reputation: 2093

dotnet build does not create `csproj.metaproj` files needed for Travis CI

I have just started to use Travis CI to build a project on git hub but according to Travis build output log Travis seems to be looking for csproj.metaproj which are not being created. How do I either:

or

And which is the better solution?

My travis yml file looks like this:

language: csharp
dist: trusty
mono: none
sudo: required
dotnet: 2.0.0
script:
  - ./build.sh --quiet verify
before_install:
  - chmod +x build.sh

My build.sh file looks like this:

#!/usr/bin/env bash
dotnet restore && dotnet build
dotnet test Code\Shared\ORMS.Shared.SharedKernel\ORMS.Shared.SharedKernel.csproj

EDIT:

Based upon answer by Tomasz Żmuda here, my build.sh file now looks like:

#!/usr/bin/env bash
dotnet restore
dotnet clean -c Release
dotnet build OpenRMS.sln -c Release

and my .travis.yml looks like:

language: csharp
dist: trusty
sudo: required
mono: none
dotnet: 2.0.0
solution: OpenRMS.sln
branches:
  only:
    - master-net-core
before_script:
  - chmod +x build.sh
  - chmod +x test.sh
script:
  - ./build.sh

and as of this build those changes worked.

Upvotes: 0

Views: 516

Answers (1)

Tomasz Żmuda
Tomasz Żmuda

Reputation: 637

Your script doesn't work even on normal machine :) The easiest way to make this working it to change

dotnet build

to

dotnet build Code/Shared/ORMS.Shared.SharedKernel/

so your script should be looks like:

#!/usr/bin/env bash
dotnet restore
dotnet build Code/Shared/ORMS.Shared.SharedKernel/
dotnet test Code/Shared/ORMS.Shared.SharedKernel.UnitTests/

I suggest to add some flags to dotnet build lika release build and assembly version. Check this file: build.sh

Upvotes: 2

Related Questions