0

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
Pieterjan
  • 2,738
  • 4
  • 28
  • 55
  • net45 is not netstandard2.0 compliant – Melchia Jul 18 '20 at 10:54
  • According to [the chart](https://learn.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support) that's true. Should I then use `netstandard2.0;netcoreapp2.0;net461` instead. Does that mean that I'm not able to target `.NET Standard 2.1` if I want to support `.NET Framework` as well? – Pieterjan Jul 18 '20 at 12:14
  • https://docs.travis-ci.com/user/languages/csharp/#testing-against-mono-and-net-core – Pieterjan Jul 18 '20 at 21:43

0 Answers0