NuGet Packages在安装时返回路径中的非法字符

时间:2014-09-11 12:55:02

标签: visual-studio-2012 nuget nuget-package

我创建了一个NuGet package,它是已经存在但已死的package的分叉。

我删除了两个我们不再使用的文件夹。因为它们太长了,因为窗户限制了260个字符。

当我尝试通过VS2012中的GUI安装新软件包时,它会失败并返回

  

路径中的非法字符。

当我尝试使用程序包管理器控制台时,出现以下错误:

PM> Install-Package NC.Frontend.Env
Installing 'NC.Frontend.Env 1.0.1'.
Install failed. Rolling back...
Install-Package : Illegal characters in path.
At line:1 char:1
+ Install-Package NC.Frontend.Env
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], ArgumentException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

我也试过了nuget install NC.Frontend.Env -Verbosity detailed,但没有多少曝光:

GET http://nuget.episerver.com/feed/packages.svc/FindPackagesById()?$filter=IsLatestVersion&$orderby=Version desc&$top=1&id='NC.Frontend.Env'
GET http://nuget.episerver.com/feed/packages.svc/FindPackagesById()?id='NC.Frontend.Env'
GET https://www.nuget.org/api/v2/FindPackagesById()?$filter=IsLatestVersion&$orderby=Version desc&$top=1&id='NC.Frontend.Env'
GET https://www.nuget.org/api/v2/Packages(Id='NC.Frontend.Env',Version='1.0.1')
nuget : System.ArgumentException: Illegal characters in path.
At line:1 char:2
+  nuget install NC.Frontend.Env -Verbosity detailed
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (System.Argument...acters in path.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
   at System.IO.Path.GetDirectoryName(String path)
   at NuGet.ZipPackage.IsPackageFile(PackagePart part)
   at NuGet
.OptimizedZipPackage.<EnsurePackageFiles>b__9(PackagePart part)
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at NuGet.OptimizedZipPackage.EnsurePackageFiles()
   at NuGet.OptimizedZipPackage.GetAssemblyReferencesCore()
   at NuGet.LocalPackage.get_AssemblyReferences()
   at NuGet.DataServicePackage.get_AssemblyReferences()
   at NuGet.PackageExtensions.HasProjectContent(IPackage package)
   at NuGet.PackageWalker.GetPackageTarget(IPackage package)
   at NuGet.PackageWalker.GetPackageInfo(IPackage package)
   at NuGet.PackageWalker.ProcessPackageTarget(IPackage package)
   at NuGet.PackageWalker.Walk(IPackage package)
   at NuGet.InstallWalker.ResolveOperations(IPackage package)
   at NuGet.PackageManager.Execute(IPackage package, IPackageOperationResolver resolver)
   at NuGet.PackageManager.InstallPackage(IPackage package, FrameworkName targetFramework, Boolean ignoreDependencies, Boolean allowPrereleaseVersions, Boolean ignoreWalkInfo)
   at NuGet.PackageManager.InstallPackage(IPackage package, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
   at NuGet.PackageManager.InstallPackage(String packageId, SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions)
   at NuGet.Commands.InstallCommand.InstallPackage(IFileSystem fileSystem, String packageId, SemanticVersion version)
   at NuGet.Commands.InstallCommand.ExecuteCommand()
   at NuGet.Commands.Command.Execute()
   at NuGet.Program.Main(String[] args)

我不知道为什么会发生这种情况,因为我只删除了东西,所以看起来很奇怪。

2 个答案:

答案 0 :(得分:0)

您的包装中仍有很长的路径。只有当我的项目文件夹位于root时,我才设法安装你的软件包:

successful install

否则我会收到长路径错误:

long path error

也许您应该考虑使用经典安装或vsix进行工具,并且只考虑直接项目依赖性?或者可能将工具分成几部分?已有node和npm的包:

https://www.nuget.org/packages/Node.js/

https://www.nuget.org/packages/Npm/

答案 1 :(得分:-1)

我发现这是由于我使用的工具。

我使用的是GUI工具,但是当我使用命令行工具时,一切都运行得很好。