Paket: Cannot pack netcore project

Created on 12 Jul 2017  ·  8Comments  ·  Source: fsprojects/Paket

Description

As per the title :)

Repro steps

git clone https://github.com/fable-compiler/Fable
cd Fable
git checkout 19ff181
cd src/dotnet/Fable.Compiler
dotnet restore
dotnet pack

Expected behavior

A .nupkg is created

Actual behavior

The command fails with the following error:

~/d/F/s/d/Fable.Compiler ❯❯❯ dotnet pack
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.

  Fable.Core -> /Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Core/bin/Debug/netstandard1.6/Fable.Co
re.dll
  Fable.Compiler -> /Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/bin/Debug/netstandard1.6/
Fable.Compiler.dll
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018: The "PackTask" taskfailed unexpectedly. [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/obj/Fable.Compiler.1.1.10.nuspec;/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/obj'. [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter) [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at Interop.CheckIo(Int64 result, String path, Boolean isDirectory, Func`2 errorRewriter) [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at System.IO.UnixFileSystem.SetCurrentDirectory(String fullPath) [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at System.IO.Directory.SetCurrentDirectory(String path) [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.SetupCurrentDirectory(PackArgs packArgs) [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at NuGet.Build.Tasks.Pack.PackTaskLogic.GetPackArgs(IPackTaskRequest`1 request) [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at NuGet.Build.Tasks.Pack.PackTask.Execute() [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]
/Users/alfonsogarciacaronunez/dev/Fable/.paket/Paket.Restore.targets(89,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() [/Users/alfonsogarciacaronunez/dev/Fable/src/dotnet/Fable.Compiler/Fable.Compiler.fsproj]

Known workarounds

Haven't found any yet :(

Paket 5.6.9
dotnet SDK 1.0.4
macOS 10.12.5

bug

All 8 comments

Commenting out this line in Paket.restore.targets and removing the obj folder seems to work, but next time if you don't remove obj folder again you get the same error.

    <Exec Command='$(PaketCommand) fix-nuspec file "@(_NuspecFiles)" references-file "$(PaketReferencesFilePath)" ' />

However, the published package lists all transitive dependencies as direct dependencies. See this.

Please note packaging was working before and I haven't upgraded the dotnet SDK version in between. I did get a message at some point like Please use the new fix-nuspecs syntax (nuspecs with an s at the end).

Summoning the dotnet SDK White Wizard, @enricosada.

In https://github.com/fsprojects/Paket/commit/c699dbea7873e841d168f1f277e740cd8954839d I have:

<UseNewPack>false</UseNewPack>

@enricosada is there a way to set UseNewPack to true if the dotnet cli version is >= 2?

Seems to have been fixed by https://github.com/fable-compiler/Fable/pull/1066 😸 Shall I close?

yeah so we "just" neeed that flag set correctly then I can release the paketb update and the new targets file will spread

Some options:

| Property | .net core sdk 1.0 | .net core sdk 2.0 |
|--|--|--|
|NuGetToolVersion | 4.0.0 | 4.3.0 |
| BundledNETStandardTargetFrameworkVersion | not set | 2.0 |

afaik is better check NuGetToolVersion, i dont think will change with a minor update of sdk 1.0

that's done just checking the props, like dotnet build -v diag > log.txt (or msbuild /t:Build /v:diag > log.txt) if can be useful later

for set it, usual Condition on prop

<UseNewPack Condition=" '$(NuGetToolVersion)' != '4.0.0' ">true</UseNewPack>

thanks!

I tried this and it seems that this command doesn't generate dependency groups.

Closing, origin issue was fixed

I tried this and it seems that this command doesn't generate dependency groups.
@haf can you open a bug about this? is related to paket pack? afaik latest version with dotnet pack
or msbuild /t:Pack works

Was this page helpful?
0 / 5 - 0 ratings