I have a solution with multiple projects, one of which targets .NET Core 3.
I need to build another project in the solution using both the VS 2019 image and the 2017 image. For the 2017 image, I don't need to build the .NET Core project; so I've disabled the build on that project using the VS Configuration Manager. However, the build still fails:
C:\Program Files\dotnet\sdk\2.2.108\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [C:\projects\antlr4parsetreevisualizer_visualizerTestCore_visualizerTestCore.csproj]
because of that one project.
How can I tell AppVeyor to ignore the project in this instance?
I tried explicitly setting the build: project:
element, but to no avail.
Initially, I only had one .csproj
file to build per configuration. Per build image, I passed the project to dotnet restore
(in my case I also had to rework the matrix logic to depend on the appveyor_build_worker_image
environment variable):
environment:
matrix:
- job_name: VS 2019 build
appveyor_build_worker_image: Visual Studio 2019
- job_name: VS 2017 build
appveyor_build_worker_image: Visual Studio 2017
# ...
for:
# ...
-
matrix:
only:
- appveyor_build_worker_image: Visual Studio 2017
configuration: ReleaseCI2017
build:
project: 2017\2017.csproj
before_build:
- cmd: dotnet restore 2017\2017.csproj
Once I did that, everything seems to work, even without downloading+installing .NET Core 3 in an install
script.
Thread on AppVeyor support forum
But as it turned out, I needed to build two projects for each image. I've resolved this by using additional solution files to control which projects should be built under each image, instead of relying on the VS configuration manager.
I then pass each solution to the build: project
element, and AppVeyor will only attempt to build the specific projects referenced by that solution.