NuGetter无法在托管TFS服务器上创建目录

时间:2013-01-28 03:30:54

标签: tfs nuget nugetter

我正在尝试使用NuGetter在tfs.VisualStudio.com上的托管构建服务器中创建NuGet包。我的理解是,一旦工具尝试创建一个新文件夹用作打包过程的分段基础,它就会失败。这是我得到的错误:

Exception Message: Access to the path '$/main/Drops/MyBuild/MyBuild_20130128.4\NuGetPackage' is denied. (type UnauthorizedAccessException)
Exception Stack Trace:    
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at TfsBuild.NuGetter.Activities.CreateFolder.Execute(CodeActivityContext context) in c:\Users\svc-tauintbuilder\Downloads\Source\TfsBuild.NuGetter.Activities\CreateFolder.cs:line 53   
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

该项目是开源的,所以我看了一下该区域的代码,这只是对Directory.CreateDirectory的简单调用:

public string DoCreateFolder(string dropLocation, string folderName)
{
    string folderToCreate;

    if (Path.IsPathRooted(folderName))
    {
        folderToCreate = folderName;
    }
    else
    {
        folderToCreate = Path.Combine(dropLocation, folderName);
    }

    if (!Directory.Exists(folderToCreate))
    {
        Directory.CreateDirectory(folderToCreate);
    }

    return folderToCreate;
}

对于TFS,无论是否托管,我都是新手。我能解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

我注意到方法签名和错误中的文件路径($ / main / Drops ...)我猜这可以使用本地TFS重现,您可以将构建配置为归档到源代码控制。 Directory类不会理解$ /引用的内容。它似乎需要传递BinariesRoot或类似的东西,然后让TFS选择所有内容并检查它。