We successfully moved to continuous integration earlier this year and are working on setting up our development with a continuous deployment. To run our tests on every pull request, we wanted a pipeline step that would ensure all our tests passed. The project is on .NET core v2.2.
At first, I tried the default configuration using microsoft/dotnet:sdk but ran into the following issue:
A compatible SDK version for global.json version: [2.2.101] from [/opt/atlassian/pipelines/agent/build/Project/global.json] was not found
Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
After researching this a bit, it finally dawned on us that there was an incompatibility between our global.json defined version and the SDK version available in the Docker image.
It turned out we needed to ensure that our global.json version had to match the SDK version available. In our case, we determined we no longer needed the global.json file and removed it.
For reference, here is what our pipeline configuration looked like:
name: Build and Run Back-End Unit Tests
- cd Project/
- dotnet restore
- dotnet build ProjectService --no-restore
- dotnet test ProjectService_Tests --no-build --no-restore