Is there a way to build a VS2017 solution which has .Net Core and .Net Framework projects in Travis CI?

166 views Asked by At

I'm trying to build a solution in Travis CI with two kinds of projects, .Net Core and .Net Framework, but I haven't achieved it, it can build a solution with only .Net Framework or only .Net Core projects, but not for both in the same solution.

I appreciate if someone already has dealt with the same problem and can help me.

Thanks!

2

There are 2 answers

0
Geovanny Alzate Sandoval On BEST ANSWER

I created a standard build for .Net Framework projects and in order to build the .Net Core projects in the same solution, I just created a some post-build commands like this:

dotnet restore EFCore.DbContextFactory.Examples.Data/EFCore.DbContextFactory.Examples.Data.csproj --verbosity m

dotnet restore EFCore.DbContextFactory.Examples.WebApi/EFCore.DbContextFactory.Examples.WebApi.csproj --verbosity m

dotnet restore EFCore.DbContextFactory/EFCore.DbContextFactory.csproj --verbosity m

dotnet publish EFCore.DbContextFactory.Examples.Data/EFCore.DbContextFactory.Examples.Data.csproj

dotnet publish EFCore.DbContextFactory.Examples.WebApi/EFCore.DbContextFactory.Examples.WebApi.csproj

dotnet publish EFCore.DbContextFactory/EFCore.DbContextFactory.csproj

Then for unit test I'm using that command to execute the tests and generate the results file:

dotnet test  EF.DbContextFactory.UnitTest.Data\EF.DbContextFactory.UnitTest.Data.csproj --logger "trx;LogFileName=output.trx"

So lastly I publish the tests results on appveyor (Powershell):

$wc = New-Object 'System.Net.WebClient'
$wc.UploadFile("https://ci.appveyor.com/api/testresults/mstest/$($env:APPVEYOR_JOB_ID)", (Resolve-Path EF.DbContextFactory.UnitTest.Data\\TestResults\output.trx))

And that's it. BTW in order to restore the nuget packages I have this before build script:

nuget restore
1
StephenG On

Look at appveyor (https://www.appveyor.com/), a CI service for Windows builds