Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget package manager update 3.1.1.0 broken

Tags:

I updated Nuget package manager to version 3.1.1.0. After the update opening any project gives me the error message: copy-item: cannot find path 'c:\users{username}\documents\visual studio 2015\projects{project name}\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\lib\net45' because it does not exist ..... in file init.ps1

I found $installpath variable given to init.ps1 differs from old nuget to actual in additionally appended \tools subdirectory name, which is obviously wrong and gives the error.

How can I influence this $installpath parameter or downgrade nuget to 3.1.0?

I double-checked this behaviour also in a fresh installed vm with the same result, VS installed -> ok, update to nuget 3.1.1 -> broken.

Environment: Windows 10 German, Visual Studio 2015 Community Edition English

like image 900
Big wolve Avatar asked Aug 02 '15 09:08

Big wolve


2 Answers

Not sure if this will help others, but I got the exact same error on VS2015 with Microsoft.CodeDom.Providers.DotNetCompilerPlatform and what fixed it for me was to do the following in the Package Manager Console:

Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform 

Then after saving, closing and reopening VS, no more errors. No need to edit any ps1 files for me.

FWIW.

like image 60
Rob Avatar answered Sep 17 '22 14:09

Rob


I got the same error as well (as follows):

Copy-Item : Cannot find path 'C:\Development\GitHub\pd-tech-demo\backend\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\lib\net45' because it does not exist. At C:\Development\GitHub\pd-tech-demo\backend\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\init.ps1:23 char:1 + Copy-Item $libDirectory\* $binDirectory | Out-Null + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo          : ObjectNotFound: (C:\Development\...tools\lib\net45:String) [Copy-Item], ItemNotFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand 

I changed line 10 of init.ps1 from:

$libDirectory = Join-Path $installPath 'lib\net45' 

to:

$libDirectory = Join-Path $installPath '..\lib\net45' 

which fixes the problem (only until you restore the package again and you get the broken version).

The real fix is for the package maintainers to update their copy of init.ps1. I'll follow up and see if we can get that done. :)

like image 28
Tod Thomson Avatar answered Sep 20 '22 14:09

Tod Thomson