I have .NET Core projects I am trying to build using Travis CI on Mac and Linux using the latest Mono and .NET Core 1.0.1 tooling (MSBuild based csproj tooling). They target netstandard1.6.1
, net45
and net461
. The error I get from Travis CI is:
/usr/share/dotnet/sdk/1.0.1/Microsoft.Common.CurrentVersion.targets(1111,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
Does Mono not support VS 2017 MSBuild based csproj projects? How can I get my projects to build?
Use of the Build Tools require a valid Visual Studio license. If you can use the Visual Studio Community for free, you can also use the Build Tools with a valid free license.
You can build your . NET Core projects just as easily as your regular . NET projects, using either MSBuild ( MSBuild::Build-Project ) or the newer . NET Core CLI, dotnet.exe ( DotNet::Build ).
MSBuild versions with Visual Studio, but is also included in the . NET SDK. The SDK has a minimum version of MSBuild and Visual Studio that it works with, and it won't load in a version of Visual Studio that's older than that minimum version.
There are two options here, as far as I'm aware:
Use the FrameworkPathOverride
environment variable as described in this issue to point to them.
Restrict your Travis build to only build against .NET Core. This is significantly simpler in my experience.
Here's the Noda Time .travis.yml
file I'll be using for Noda Time when I can migrate - it's preliminary to say the least, but it does build...
language: csharp
mono: none
dotnet: 1.0.1
dist: trusty
script:
- dotnet restore src/NodaTime
- dotnet restore src/NodaTime.Test
- dotnet restore src/NodaTime.Serialization.Test
- dotnet build src/NodaTime -f netstandard1.3
- dotnet build src/NodaTime.Test -f netcoreapp1.0
- dotnet build src/NodaTime.Serialization.Test -f netcoreapp1.0
- dotnet run -p src/NodaTime.Test/*.csproj -f netcoreapp1.0 -- --where=cat!=Slow
- dotnet run -p src/NodaTime.Serialization.Test/*.csproj -f netcoreapp1.0
A few notes on this:
dist: xenial
, but it didn't. (It claims the environment doesn't support .NET Core.) My guess is this will change.dotnet run
to run testsdotnet run
(as per dotnet restore
and dotnet build
) but that seems to be the way of things. I'll hunt down a bug report...In either case, I'd recommend also having a Windows-based CI build to check that everything builds and works on Windows (ideally testing each framework you support).
As of yesterday (May 5th), @dasMulli pointed out that Mono released Mono 5.0 Beta 2 (5.0.0.94) that works with .NET Core! Here is his post on dotnet/sdk#335. Here is a link to the latest beta release
My .travis.yml file looks like:
sudo: required
dist: trusty
language: csharp
solution: MySolution.sln
mono:
- beta
dotnet: 1.0.3
install:
- nuget restore MySolution.sln
- dotnet restore MySolution.sln
script:
- msbuild /t:Rebuild MySolution.sln
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With