dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.72k stars 1.07k forks source link

dotnet build -o /some-folder fails: Access to the path /some-folder" is denied #10572

Closed maurei closed 4 years ago

maurei commented 5 years ago

Steps to reproduce

  1. Create a boilerplate .net core 3 app, eg console app (I used Visual Studio Mac 8.3.4)
  2. run dotnet build -o /test

Expected behavior

A working build

Actual behavior

  Restore completed in 55.54 ms for /Users/moeys/Code/test/test/test.csproj.
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(1124,5): warning MSB3191: Unable to create directory "/test/". Access to the path '/test/' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/appsettings.json" to "/test/appsettings.json". Access to the path '/test' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/Properties/launchSettings.json" to "/test/Properties/launchSettings.json". Access to the path '/test/Properties' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/obj/Debug/netcoreapp3.0/test" to "/test/test". Access to the path '/test' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/appsettings.Development.json" to "/test/appsettings.Development.json". Access to the path '/test' is denied. [/Users/moeys/Code/test/test/test.csproj]

Build FAILED.

/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(1124,5): warning MSB3191: Unable to create directory "/test/". Access to the path '/test/' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/appsettings.json" to "/test/appsettings.json". Access to the path '/test' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/Properties/launchSettings.json" to "/test/Properties/launchSettings.json". Access to the path '/test/Properties' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/obj/Debug/netcoreapp3.0/test" to "/test/test". Access to the path '/test' is denied. [/Users/moeys/Code/test/test/test.csproj]
/usr/local/share/dotnet/sdk/3.0.100/Microsoft.Common.CurrentVersion.targets(4563,5): error MSB3021: Unable to copy file "/Users/moeys/Code/test/test/appsettings.Development.json" to "/test/appsettings.Development.json". Access to the path '/test' is denied. [/Users/moeys/Code/test/test/test.csproj]
    1 Warning(s)
    4 Error(s)

Time Elapsed 00:00:01.04

Environment data

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.0.100/

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

.NET Core SDKs installed:
  2.1.700 [/usr/local/share/dotnet/sdk]
  2.2.301 [/usr/local/share/dotnet/sdk]
  3.0.100 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
maurei commented 5 years ago

Actually, I guess it makes sense that dotnet does not have access to the very root of my machine. The situation in which I encountered it was with a a Dockerfile, in which case it shouldn't be a problem. Will update my repro case tomorrow, but perhaps this might not turn out to be the correct repository for this issue