2015-03-31 50 views
3

我试图使用假来恢复我的NuGet包我的构建脚本的一部分,但我需要使用要求身份验证的专用饲料(Artifactory的)。F#/ FAKE的NuGet私人饲料认证

我碰到这个而寻找解决的办法。 https://github.com/fsharp/FAKE/issues/119

它表明通过提交解决了问题,但我无法确定提交或提交进入的版本的位置,并且似乎没有任何记录的使用方式。

Target "RestorePackages" (fun _ -> 
    "./**/*.sln" 
    |> RestoreMSSolutionPackages (fun p -> 
     { p with 
      Sources = "{url}" :: p.Sources 
      OutputPath = outputDir 
      Retries = 4 }) 
) 

我通过源看了一下,发现上面的代码,虽然它似乎没有身份验证有关的参数,除非他们传递到源参数?

有没有人对越来越FAKE包恢复与认证工作的任何经验或知识?

+0

您不能将{url}设置为预先验证的nuget Feed吗? – forki23 2015-03-31 15:57:39

+1

你有没有考虑过使用问题?您可以直接从F#使用它,并且它支持经过身份验证的源代码http://fsprojects.github.io/Paket/nuget-dependencies.html – 2015-03-31 16:04:30

+0

@FyodorSoikin有趣,从未听说过Paket。在FAKE构建脚本中是否有Paket的工作示例? – devfunkd 2015-03-31 16:24:45

回答

2

您可以添加凭据您nuget.config并在恢复指定。

{ p with 
    Sources = p.Sources 
    OutputPath = outputDir 
    Retries = 4 
    ConfigFile = Some "./tools/nuget/nuget.config" } 

然后添加类似这样的东西到你的配置。

<packageSource> 
    <add key="feedName" value="http://example.com/Feed.svc" /> 
</packageSource> 
<packageSourceCredentials> 
    <feedName> 
     <add key="Username" value="xxx" /> 
     <add key="ClearTextPassword" value="secret" /> 
    </feedName> 
</packageSourceCredentials> 

https://docs.nuget.org/consume/nuget-config-settings

+0

现在全部阅读。请看看问题。它运行得更好,速度更快,然后nuget。 – albertjan 2016-08-08 21:16:48

1

在平均时间的 “ConfigFile实现” 字段是不是(不再)可用。但是,您应该能够利用nuget.config文件的分层特性(在此解释:https://docs.nuget.org/consume/nuget-config-file)。

请同时参阅章节“为包源凭证”用于以加密的方式存储的密码。

+0

顺便说一句,我看到引导支持(http://fsharp.github.io/FAKE/apidocs/fake-boot.html)确实支持使用私有提要的凭据作为参数......但是我找不到支持RestorePAckageHelper http://fsharp.github.io/FAKE/apidocs/fake-restorepackagehelper.html – 2016-01-29 09:01:14