0

I had a VS 2017 project that targeted netcore 2.1. This was built and deployed using a YAML build pipeline on the hosted vs 2017 agent.

We needed to support netcore 3.1 as well as 2.1 so I updated the project to VS 2019 and changed it to multi-target both netcore 2.1 and 3.1. This builds fine on my dev machine but (obviously) failed on the existing build pipeline that uses the vs 2017 image.

Based on the documentation I have update the build pipeline to use the 'windows-2019' vm image.

However, this gives me the following error message:

The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.

I'd rather not create and maintain a build server internally for this so is it possible on a hosted agent?

Steve
  • 1,266
  • 16
  • 37
  • 1
    I could not reproduce this issue with `netcoreapp3.1; netcoreapp2.1` in hosted agent `windows-2019`, but it works fine. Would you please share your project file and the yaml to us, so that we could reproduce this issue? – Leo Liu Feb 17 '20 at 08:37
  • 1
    I have discovered that the issue was not quite as simple as it first appeared. The problem was that the test projects were targeting netcore 2.1 and we are using the vstest task rather than netcore test (we need to use this for other reasons). The tests run for x64 and x86 on both debug and release configurations. We only get the problem when it performs the x86 test. I've resolved this by updating the test projects to target netcore 3.1 – Steve Feb 17 '20 at 08:54

1 Answers1

0

This turns out to have been caused by the test projects still targeting netcore 2.1.

Our build pipeline runs tests (using the vstest task) on both x86 and x64 and it was only the x86 tests that were failing.

After we updated the test projects to netcore 3.1, it worked as expected and the tests passed.

Steve
  • 1,266
  • 16
  • 37