Paket
Paket copied to clipboard
Dotnet restore fails for container running on Linux, but succeeds on Windows.
I have docker file with build process:
FROM mcr.microsoft.com/dotnet/sdk:3.1-buster as build
WORKDIR /Repo
COPY . .
RUN dotnet tool restore -v diag
RUN dotnet restore src -v diag
RUN dotnet build --no-restore -c Release -v diag src
RUN dotnet paket pack --interproject-references keep-major ../out
This works on Windows, but fails on Linux: (and in GitLab pipeline)
cloudflare-fsharp-api-package/.paket/Paket.Restore.targets(171,5): error MSB3073: The command "mono --runtime=v4.0.30319 "/builds/migamake/migamake-hurl/cloudflare-fsharp-api-package/.paket/paket.exe" restore" exited with code 127.
I have no idea how host can affect MSBuild running within docker container.
I found the reason:
If paket.exe
exists locally, for some reason dotnet restore
in docker running on Linux resolves to .paket/paket.exe
via Paket.Restore.targets
.
Workaround, to modify .paket\Paket.Restore.targets in two locations:
row 32:
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
to
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">dotnet paket</PaketBootStrapperCommand>
and
row 99:
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</_PaketCommand>
to
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">dotnet paket</_PaketCommand>
@voroninp were you able fix it?
@cricarba , no, as far as I remember.