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?
Since the project uses VS 2017 and the "released" .NET CLI tooling, you also need to use the Hosted VS2017
agent queue for the build so that the build will be run on an agent that has the necessary tools installed.
The version of the shared runtime host (dotnet.exe
) is the same, the difference is that a newer CLI needs to be installed as well (which is in the sdk
subdirectory of the directory where dotnet.exe
is).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With