Nuget Broke my Build — error MSB4181: The “PackTask” task returned false but did not log an error.
I recently decided to update my dotnet core sdk tools to the latest version. I did this by installing the latest sdk and updating my global.json file. If you read the MS documentation then all will be good, that however was not my experience.
The new global.json was
All seemed fine until I ran a dotnet pack command — specifically dotnet pack -c Release which generated the error
(198,5): error MSB4181: The "PackTask" task returned fals
e but did not log an error.
Although this appears to be related to the fact that I prefer Paket, the solution may work for nuget users too, though I haven’t tested it.
Fortunately for me the solution was a simple one, I simply reverted global.json to the following
which is what I have for most of my libraries. The important part here is the SDK version of 3.1.302. If I use this everything works as expected.
Luckily for me I am using an LTS, if you happen to be using .NET 5 then you may have to wait for a solution