This is kinda follow up on the following: Set up CI with Travis for .NET Core
I'm trying to implement Travis CI for all my Github repositories. I have a class library targetting all main "frameworks"
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net45</TargetFrameworks>
This is necessary for WPF support. I now want to add this project to Travis CI. I have tried with the following .travis.yml
language: csharp
mono: latest
dotnet: 3.1.302
before_install:
- sudo apt-get update
install:
- dotnet restore
script:
- dotnet build ./MintPlayer.ObservableCollection/MintPlayer.ObservableCollection.csproj --configuration Release
sudo: required
But since my project targets .NET Framework as well, the build attempt for .NET Framework fails since off course .NET Framework is not compatible with Linux. From what I've read on the internet that's probably what the ReferenceAssemblies are for?
And instead of the dotnet
CLI tools, I assume you must use the MSBuild
tools. How can I properly implement both cases in my .travis.yml
to get a successful CI to build in all 3 cases?
I also found the following link, explaining that you need to use MSBuild
instead of dotnet
, but I have no idea how to combine both in my .travis.yml
.
Update:
Following .travis.yml is able to build a .NET Framework console app:
language: csharp
mono: latest
dotnet: 3.1.200
script:
- msbuild /t:Restore
- msbuild /p:Configuration=Release