Home: nuget pack Illegal characters in path.

Created on 5 Jul 2019  Â·  6Comments  Â·  Source: NuGet/Home

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): nuget.exe

NuGet version (x.x.x.xxx): NuGet Version: 5.0.2.5988

dotnet.exe --version (if appropriate):

VS version (if appropriate): 2013

OS version (i.e. win10 v1607 (14393.321)): Windows 7

Worked before? If so, with which NuGet version: NuGet Version: 4.8.1.5435

Detailed repro steps so we can see the same problem

  1. Use attached zipped project. Note that on my machine, the project was located in C:\dev\NugetTest

  2. nuget pack NugetTest.csproj

Output is:
c:\dev\NugetTest>nuget pack
Attempting to build package from 'NugetTest.csproj'.
Illegal characters in path.
...

Other suggested things

Verbose Logs

Please include verbose logs (NuGet.exe -verbosity detailed | dotnet.exe --verbosity diag | etc...)

NuGet Version: 5.0.2.5988
Attempting to build package from 'NugetTest.csproj'.
Illegal characters in path.
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate) at NuGet.CommandLine.MsBuildUtility.GetMSBuild() at NuGet.CommandLine.MsBuildUtility.GetMsBuildToolset(String userVersion, IConsole console) at System.Lazy1.CreateValue()
at System.Lazy1.LazyInitValue() at NuGet.CommandLine.PackCommand.<ExecuteCommand>b__80_0() at System.Lazy1.CreateValue()
at System.Lazy`1.LazyInitValue()
at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
at NuGet.Commands.PackCommandRunner.BuildPackage()
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)

Note: there is no error when running with previous version of Nuget (as noted above).

Sample Project

NugetTest.zip

Very helpful if you can zip a project and paste into this issue!

Pack Duplicate Bug

Most helpful comment

no, nuget pack failed because the nuspec didn't have authors or a description, but it was able to find msbuild successfully on my machine, so I couldn't reproduce the same error as reported.

All 6 comments

Can you please check your PATH to see if there's anything unusual there?

The section of code that is throwing the exception is the following:

https://github.com/NuGet/NuGet.Client/blob/ea3458258a63d7329d2cf1c9a7f75885d16ffc3e/src/NuGet.Clients/NuGet.CommandLine/MsBuildUtility.cs#L976-L1001

The exception comes from line 992, where it's trying to combine a directory from your environment's PATH with a static string.

@zivkan could you repro this with the repro project?

no, nuget pack failed because the nuspec didn't have authors or a description, but it was able to find msbuild successfully on my machine, so I couldn't reproduce the same error as reported.

Hi. getting the same error here, this is a real drag.
here's the path I have:

C:\Program Files (x86)\Java\jre1.8.0_151\bin;C:\Program Files (x86)\Google\Chrome\Application;D:\app\product\12.2.0\client_64\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ESET\ESET Security\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\mingw32\bin;C:\Program Files (x86)\Git\usr\bin;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Users\integrator\AppData\Local\Microsoft\WindowsApps;;"C:\Program Files\Java\jre1.8.0_221\bin"

I would expect nuget to skip over bad path entries and not fault the whole thing on these, in line with how the system behaves in general with bad path entries.

I would expect Nuget to work as it did in previous version, without
introducing new issue like this.

On Thu, Sep 5, 2019 at 4:45 PM gilbahat notifications@github.com wrote:

Hi. getting the same error here, this is a real drag.
here's the path I have:

C:\Program Files (x86)\Java\jre1.8.0_151\bin;C:\Program Files
(x86)\Google\Chrome\Application;D:\app\product\12.2.0\client_64\bin;C:\Program
Files (x86)\Common
Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program
Files\ESET\ESET Security;C:\Program Files (x86)\Git\cmd;C:\Program Files
(x86)\Git\mingw32\bin;C:\Program Files (x86)\Git\usr\bin;C:\Program
Files\dotnet;C:\Program Files\Microsoft SQL
Server\130\Tools\Binn;C:\Users\integrator\AppData\Local\Microsoft\WindowsApps;;"C:\Program
Files\Java\jre1.8.0_221\bin"

I would expect nuget to skip over bad path entries and not fault the whole
thing on these, in line with how the system behaves in general with bad
path entries.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/NuGet/Home/issues/8303?email_source=notifications&email_token=AASPK3EAS2T2CGCZIGDWL4DQIEERBA5CNFSM4H6I6W7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD57FEAY#issuecomment-528372227,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AASPK3BQEG2CZD6JRHWR6A3QIEERBANCNFSM4H6I6W7A
.

Closing this issue as a duplicate of #8168, which had a fix merged yesterday.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsfeedback picture vsfeedback  Â·  3Comments

sylvainlavoie picture sylvainlavoie  Â·  3Comments

jainaashish picture jainaashish  Â·  3Comments

p-kaczynski picture p-kaczynski  Â·  3Comments

blackcity picture blackcity  Â·  3Comments