Build on appveyor .NET Standard 2.0

701 Views Asked by At

I migrate my project (https://github.com/MarkKhromov/The-Log) to .NET Standard 2.0 and my appveyor build is broken. How I can fix this?

My solution contains:

  • .NET Standard project
  • Console Application project
  • Class library (tests) project

I already tried wrote:

dotnet: 2.0.0
script:
  - dotnet restore
  - dotnet build

or

- dotnet build TheLog/TheLog.csproj -c Release -f netstandard2.0
- msbuild TheLog.Demos/TheLog.Demos.csproj /p:Configuration=Release
- msbuild TheLog.Tests/TheLog.Tests.csproj /p:Configuration=Debug
- nunit-console TheLog.Tests/TheLog.Tests.csproj

But every time I have errors

2

There are 2 best solutions below

2
On BEST ANSWER

You need to change your appveyor configuration to the VS 2017 image in order to build .NET Standard libraries and use the dotnet based tooling for csproj projects.

0
On

Needed to change two settings on AppVeyor.
1. Change Build worker image to Visual Studio 2017 - Environment setting
2. Add "dotnet restore" command into Before build script as CMD - Build setting

I've confirmed it on a new empty project/solution set on .NET Standard 2.0 or .NET Core 2 .