Aran Mulholland
Aran Mulholland

Reputation: 23935

Building VS2017 .net core apps that target the full .net framework

I have created a asp.net mvc core app targeting the .net framework (not the multi platform core) as I want to include standard .net framework libraries and running cross platform is irrelevant to me as I will be hosting in Azure.

The solution looks like this:

Project Files

I am trying to get a VSTS build working with this project (which is part of a larger solution) but when building I get the following error:

Build errors

Which seems to be a common error. What should my build definition look like to build these .csproj based projects? There seems to be a lot of information but no definitive answer. Hopefully that answer can be here and people can stop looking elsewhere for information on how to get a Continuous Integration build going.

On a side note at the solution level I find no packages folder containing my nuget packages, why is this? The project definitely contains nuget packages.

Upvotes: 1

Views: 435

Answers (1)

Luca Cappa
Luca Cappa

Reputation: 1999

Your project is using the newest MSBuild based project files for .NET Core. The extension is still .csproj, but the XML schema is different than the ordinary .csproj used in .NET46 (and previous versions).

You need appropriate tooling to build such .csproj file, for example:

  • Visual Studio 2017: install it on your private build agent; VSTS hosted build agent does not have VS2017 installed yet;
  • .NET Core SDK 1.0.0-preview4-004233 (or more recent): this SDK contains the command line tool 'dotnet' for MSBuild .NET Core based projects.

Note in your build log that the msbuild used is the one shipped with VS2015 (version 14.0) instead, that does not support such .csproj format file.

On the other hand, if you do not need multiplatform nor any other benefit of .NET Core, why are you using it? Just created an ordinary ASP.NET 4 web project targetting .NET 4.6.

Upvotes: 2

Related Questions