Install Nuget Package error "The path is not of a legal form"

20,642

Solution 1

Edit: If you have NuGet 3.0, then that's the problem. Just update NuGet and everything should work. The steps below apply to NuGet 3.0, which are painful and error prone. Don't go through such pain, choose the easy step, update your Nuget!

I updated to VS Express 2015 and since then i've been through some adventures.

TL;DR if you "disable" TFS (source control), you should be able to install the package. Then add the solution to source control again, but it caused me tons of problems.

So...

I see you have TFS. I have it too.

Also, I see you are getting the same error messages as me.

I tried to install LanguageExt (an awesome library for C# 6) and it failed when it tried to install one of its dependencies (System.Collections.Immutable).

If you want to go through all this things, please make a backup of your project folder.

This is what I did:

1 - Copied my solution folder to somewhere else.

2 - Opened the solution. VS smartly asked me to add it to source control, but I didn't want to.

3 - Tried to Install-Package LanguageExt

4 - Unexpected success!

5 - "Fine, let me just add it to the TFS source control again"

Here my journey started.

Since I have little experience with TFS, I got thousands and thousands of conflicts, files vanishing and appearing again, etc.

But after some work, I got it running.

And it was worth it.

But the solution isn't large, so, it was easy.

Solution 2

Had the same problem with the packages below, updated NuGet via "Tools -> Extensions and Updates -> Updates" to v.3.1.1.0 and now everything works again. Thanks!

Microsoft.Bcl

Google.Apis.Calendar.v3

RazorEngine

Sample error so more people can find this thread:

"Install-Package : The path is not of a legal form. At line:1 char:16 + Install-Package <<<< RazorEngine + CategoryInfo : NotSpecified: (:) [Install-Package], Exception + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand"

Solution 3

Had a same problem with my VS 2015, I just added the reference via nuget by opening the same solution in VS 2013 and then reopened it back in VS 2015 for usual work.

Share:
20,642
Dänu
Author by

Dänu

I'm Maharaja Bundy and women with 4 hooters feed me Ding Dongs all day

Updated on April 13, 2020

Comments

  • Dänu
    Dänu about 4 years

    When trying to install the NuGet Package RestSharp I get the error The path is not of a legal form and the package is not installed.

    When installing from the console using Install-Package RestSharp, there are a lot of the following messages:

    The item C:\Users\myName\Source\Workspaces\Project\Solution\packages\RestSharp.105.1.0\lib\net35\RestSharp.dll could not be found in your workspace, or you do not have permission to access it.

    This happens with the newly released Visual Studio 2015 (community edition).