Running Ubuntu 18.04:
1) update to dotnet core sdk 2.1.500 (via apt update/upgrade)
2) try doing "dotnet run" or "dotnet restore"
Produces a message stating an error on permissions to the NuGetFallbackFolder.
Permission denied to modify the '/usr/share/dotnet/sdk/NuGetFallbackFolder' folder.
Here are some options to fix this error:
----------------------------------------
1. Re-run this command with elevated access.
2. Disabled the first run experience by setting the environment variable DOTNET_SKIP_FIRST_TIME_EXPERIENCE to true.
3. Copy the .NET Core SDK to a non-protected location and use it from there.
Worked properly before the update
NET Core SDK (reflecting any global.json):
Version: 2.1.500
Commit: b68b931422
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.1.500/
Host (useful for support):
Version: 2.1.6
Commit: 3f4f8eebd8
.NET Core SDKs installed:
2.1.500 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.6 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.6 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
+1 on Windows 10
How did you install the SDK?
@livarcocc in my case it was plain SDK installer from https://www.microsoft.com/net/download
As in, an msi? It installed to program files?
yes, it's an exe actually
yes.
In my case (on Ubuntu-linux) I downloaded the .deb file from code.visualstudio.com and installed it using the linux tool 'dpkg'
Same here. I took ownership of /usr/share/dotnet/sdk/NuGetFallbackFolder but don't think this is intended.
Since there has been no comments to this for a while now I checked ownership/permissions on the /usr/share/dotnet/sdk/NuGetFallbackFolder. Ownership was set to root:root
. Permissions "755". Since you are not running the dotnet cli as root by default (and you really should not have to) and the dotnet cli wants to update files in this folder on running build/restore this is clearly an issue.
I went on the change the folders owners to root:users
. Then changed permissions to 775 to give the group access to edit files in the foler. Finally I added myself to group users.
This settles the issue by giving me (via the group) access to update files in folder, but as said above having to do this manually is probably not the intended way.
Everytime Ubuntu updates the dotnet package, I have this warning again and need to use one of the available workaround (usually doing a sudo dotnet new console
in a dummy directory)
Does this mean every now and then you need to run this sudo dotnet new console
to refresh the cache?
Why don't you add a post install script in the ubuntu package that does exactly that ? (sudo dotnet new console
)
Most helpful comment
Everytime Ubuntu updates the dotnet package, I have this warning again and need to use one of the available workaround (usually doing a
sudo dotnet new console
in a dummy directory)