Process.Start() fails when a directory exists in the working directory with the same name as the executable
See original GitHub issueSteps to reproduce
- Clone corefxlab repo https://github.com/dotnet/corefxlab
- Run ./build.sh
- Observe failure to restore pacakges (only on OSX and Ubuntu, package restore works fine on Windows).
From: https://github.com/dotnet/corefxlab/pull/1787 https://ci.dot.net/job/dotnet_corefxlab/job/master/job/ubuntu16.04_release_prtest/807/consoleFull#7440085258bb52e59-de52-4f1c-b131-470db4c594cd
echo "Restoring all packages"
./$dotnetExePath restore $myFile /p:VersionSuffix="$BuildVersion"
ret=$?
if [ $ret -ne 0 ]; then
echo "Failed to restore packages."
exit -1
fi
Expected behavior
Package restore succeeds on all configurations.
Previous CLI version (2.1.0-preview1-007191) was working as expected.
Actual behavior
Package restore failing with System.ComponentModel.Win32Exception.
18:50:13 System.ComponentModel.Win32Exception (0x80004005): The FileName property should not be a directory unless UseShellExecute is set. 18:50:13 at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) 18:50:13 at System.Diagnostics.Process.Start() 18:50:13 at Microsoft.DotNet.Cli.Utils.ProcessStartInfoExtensions.Execute(ProcessStartInfo startInfo) 18:50:13 at Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingApp.Execute() 18:50:13 at Microsoft.DotNet.Tools.Restore.RestoreCommand.Run(String[] args) 18:50:13 at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient) 18:50:13 at Microsoft.DotNet.Cli.Program.Main(String[] args) 18:50:13
Environment data
dotnet cli version 2.1.0-preview1-007228
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
Because you also need to change how you are invoking dotnet:
This time it failed because it could not find a the file under ./dotnet/dotnetcli. And it won’t because you renamed that folder.
Ah yes. Good catch. Tyvm.