fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 525 forks source link

using paket as a global tool without paket.bootstrapper #3435

Open vilinski opened 5 years ago

vilinski commented 5 years ago

Description

Maybe I'm doing it wrong? I have installed paket as a global dotnet tool and used it in terminal with a new dotnet project. I supposed I don't need a bootstrapper anymore. Getting error by dotnet build or restore

Repro steps

dotnet tool install paket -g
mkdir -p classlib/src/classlib
cd classlib/src/classlib
dotnet new classlib -lang f#
cd ../..
paket init
paket add FSharp.Core --project src/classlib/classlib.fsproj
cd src/classlib
dotnet build

If possible then please create a git repository with a repro sample or attach a zip to the issue.

Expected behavior

Project built without any errors.

Actual behavior

paket update works, but neither dotnet build nor dotnet restore. Getting following error:

$ dotnet build shasum: /Users/username/Projects/fsharp/classlib/.paket/../paket-files/paket.restore.cached: Cannot open assembly '/Users/username/Projects/fsharp/classlib/.paket/paket.exe': No such file or directory. /Users/username/Projects/fsharp/classlib/.paket/Paket.Restore.targets(91,5): error MSB3073: The command "/Library/Frameworks/Mono.framework/Commands/mono --runtime=v4.0.30319 "/Users/username/Projects/fsharp/classlib/.paket/paket.exe" restore" exited with code 2. [/Users/username/Projects/fsharp/classlib/src/classlib/classlib.fsproj]

Environment

MacOS with latest mono, dotnet SDK and paket

classlib.tar.gz

Known workarounds

Install paket.bootstrapper manually into .paket folder or use plain nuget instead.

inosik commented 5 years ago

From https://github.com/fsprojects/Paket/issues/3436#issuecomment-440981451:

dotnet tool install --tool-path .paket Paket

I believe the dotnet CLI creates the correct shim (paket.exe on Windows, paket on Unix) and the latest Paket.Restore.targets should already support that.

baronfel commented 5 years ago

Note that with .net sdk 3 preview 7 you can do this in a more centrally-managed way: https://gist.github.com/baronfel/80f49ecb93ebacb84ca840fca7a12fc2