2

我有一個來自私人nuget飼料的圖書館。我有網址和憑據,但不知道如何正確連接到視頻工作室的代碼。我正在使用dotnetcore框架。視覺工作室代碼和私人nuget

我在控制檯應用程序的根目錄中用提要URL和用戶名和密碼創建了一個Nuget.Config文件,但是在將它們輸入到project.json中時,似乎沒有從該提要中拾取這些包。即使執行還原也會產生錯誤。

有沒有人有他們將如何建立一個項目來做到這一點的例子?我知道在項目中使用Nuget.Config文件是不正常的,但這是一個測試項目,所以一旦項目超過了概念驗證的範圍,它就不會存在。

我nuget.config這個樣子

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <packageSources> 
     <add key="CustomRepo" value="https://nuget.feed/nuget/" /> 
    </packageSources> 

    <!-- Used to store credentials --> 
    <packageSourceCredentials> 
     <CustomRepo> 
      <add key="Username" value="something" /> 
      <add key="ClearTextPassword" value="thepassword" /> 
     </CustomRepo> 
    </packageSourceCredentials> 

     <!-- Used to disable package sources --> 
    <disabledPackageSources /> 
</configuration> 
+0

與NuGet.Config文件相關的解決方案文件在哪裏? –

+0

我沒有這個解決方案文件。只需使用dotnetcore支持的project.json文件進行滾動即可。 – Matt

+0

[將自定義軟件包源添加到Visual Studio代碼]可能的重複(https://stackoverflow.com/questions/41358490/add-custom-package-source-to-visual-studio-code) – Tomino

回答

0

Apoligies這個已經解決,在根文件夾中的文件nuget.config工作。我不知道我做了什麼。我所做的只是重新輸入整個XML,但不知道會做什麼。無論如何,這是偉大的工作。