monodevelop-nuget-addin
monodevelop-nuget-addin copied to clipboard
Unable to manage packages
I have tried to create the directory manually. I have given everyone r/w. Is there a way to switch the directory or am I missing something in setup. If there are any other logs or info, please let me know.
I have Mono MDK 3.2.1 installed and Xamarian 4.0.12 (build 3)
System.TypeInitializationException: An exception was thrown by the type initializer for ICSharpCode.PackageManagement.PackageManagementServices ---> System.UnauthorizedAccessException: Access to the path "/Users/chrisyoung/.config/NuGet" is denied.
at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x0006c] in /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.1/mcs/class/corlib/System.IO/Directory.cs:116
at System.IO.Directory.CreateDirectory (System.String path) [0x000a4] in /private/tmp/source/bockbuild-xamarin/profiles/mono-mac-xamarin-no-pcl/build-root/mono-3.2.1/mcs/class/corlib/System.IO/Directory.cs:80
at NuGet.PhysicalFileSystem.EnsureDirectory (System.String path) [0x00000] in 1 writeToStream) [0x00000] in <filename unknown>:0 at NuGet.PhysicalFileSystem.AddFile (System.String path, System.Action
1 writeToStream) [0x00000] in
Not sure. Looking at the code NuGet is trying to do:
Directory.CreateDirectory(path);
Where the path is "/Users/chrisyoung/.config/NuGet". Without recompiling NuGet.Core.dll there is no way to change the directory being used. My guess is that NuGet needs write access to the parent .config directory.
I tried the following:
- Everyone r/w access to the parent folder
- Created the .config and gave everyone r/w access
- Created the .config/NuGet folder and gave r/w access
All of these had the same result. Is there anything else I could try? Would there be a better spot to post this, since it appears to be a problem with the nuget.core.dll?
Directory.CreateDirectory(...) should work if the directory exists and is read-only.
I would probably create a simple app that just tries to create a directory and try it on different directories with different permissions. Maybe try parts of the path "/Users", "/Users/chrisyoung", etc.
using System;
using System.IO;
namespace DirectoryCreation
{
class MainClass
{
public static void Main (string[] args)
{
if (args.Length == 0) {
Console.WriteLine ("Directory name missing");
return;
}
try {
string path = args [0];
Directory.CreateDirectory (path);
} catch (Exception ex) {
Console.WriteLine (ex.ToString ());
}
}
}
}
The NuGet.Core source used by the addin is available on GitHub if you want to modify it but it seems like we should be able to get it working without changing the code.