Dotnet restore MyProj.csproj thows "The file type is not recognised" on VSTS

Viewed 1307

I'm making my build pipeline for dotnet Core project. Part of my build script executes dotnet restore. I do it this way:

dotnet restore C:/Projects/MyProj/src/MyProj/MyProj.csproj

And it restores locally without a problem. When I push the same script to VSTS build server, in logs I see execution like this:

dotnet restore D:/a/1/s/src/MyProj/MyProj.csproj

but then I get error:

error: Invalid input 'D:/a/1/s/src/MyProj/MyProj.csproj'. The file type was not recognized.

What am I doing wrong? why does it work locally and not on VSTS.

I'm using the same version of dotnet.exe locally as on VSTS:

Version : 1.1.0
Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86

I've got a global.json file sitting outside of src folder:

{
  "projects": ["src"],
  "sdk": {
    "version": "1.1.0"
  },
  "packages": "packages"
}

Folder structure as following:

   Root/
       build.cake
       build.ps1
       global.json
       src/
          MyProj.sln
          MyProj/
            MyProj.csproj
            *.cs
          MyProj.Tests/
            MyProj.Tests.csproj
            *.cs

Solution is created in VS2017, so this is latest csproj file format.

What else should I check?

1 Answers
Related