2015-03-31 90 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