2016-06-29 17 views
2

Ich habe eine .NET Core 1.0-Klassenbibliothek, die ein Nuget-Paket verwendet, das in einem Visual Studio Team Services Nuget-Feed gehostet wird.So verwenden Sie die dotnet-Zurückschreibung auf Visual Studio Team Services Hosted Build Agent mit VSTS Nuget-Feed

Wir verwenden die Visual Studio Team Services zum Erstellen der Klassenbibliothek und haben eine Builddefinition mit einem Buildschritt, der eine dotnet restore für das Projekt ausführt. Der Befehl schlägt mit den folgenden Fehler:

2016-06-28T13:07:09.0634265Z ##[warning]File name doesn't indicate a full path to a executable file. 
2016-06-28T13:07:09.0644179Z Executing the following command-line. (workingFolder = C:\a\1\s) 
2016-06-28T13:07:09.0644179Z dotnet restore 
2016-06-28T13:07:09.0654186Z Error message highlight pattern: 
2016-06-28T13:07:09.0654186Z Warning message highlight pattern: 
2016-06-28T13:07:11.6393062Z log : Restoring packages for C:\a\1\s\src\Company.Extensions\project.json... 
2016-06-28T13:07:11.7623059Z info : GET https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model' 
2016-06-28T13:07:11.8463064Z info : GET https://api.nuget.org/v3-flatcontainer/Company.model/index.json 
2016-06-28T13:07:12.0162954Z info : Unauthorized https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model' 254ms 
2016-06-28T13:07:12.0702952Z log : Retrying 'FindPackagesByIdAsyncCore' for source 'https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model''. 
2016-06-28T13:07:12.0712954Z log : Response status code does not indicate success: 401 (Unauthorized). 
2016-06-28T13:07:12.0712954Z info : GET https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model' 
2016-06-28T13:07:12.0722952Z info : NotFound https://api.nuget.org/v3-flatcontainer/Company.model/index.json 224ms 
2016-06-28T13:07:12.1426754Z info : Unauthorized https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model' 73ms 
2016-06-28T13:07:12.1436737Z log : Retrying 'FindPackagesByIdAsyncCore' for source 'https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model''. 
2016-06-28T13:07:12.1436737Z log : Response status code does not indicate success: 401 (Unauthorized). 
2016-06-28T13:07:12.1446974Z info : GET https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model' 
2016-06-28T13:07:12.2162787Z info : Unauthorized https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model' 72ms 
2016-06-28T13:07:12.2172786Z error: Failed to retrieve information from remote source 'https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model''. 
2016-06-28T13:07:12.2172786Z error: Response status code does not indicate success: 401 (Unauthorized). 
2016-06-28T13:07:12.2364584Z error: Failed to retrieve information from remote source 'https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2/FindPackagesById()?id='Company.Model''. 
2016-06-28T13:07:12.2374607Z error: Response status code does not indicate success: 401 (Unauthorized). 

Offensichtlich scheitert es daran, dass FeedName erfordert, dass wir es authentifizieren, weshalb wir auch diese Seite unserer project.jsonnuget.config Datei haben:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <packageSources> 
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> 
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" /> 
    <add key="FeedName" value="https://Company.pkgs.visualstudio.com/DefaultCollection/_packaging/FeedName/nuget/v2" /> 
    </packageSources> 
    <packageRestore> 
    <add key="enabled" value="True" /> 
    <add key="automatic" value="True" /> 
    </packageRestore> 
    <bindingRedirects> 
    <add key="skip" value="False" /> 
    </bindingRedirects> 
    <FeedName> 
    <add key="Username" value="username" /> 
    <add key="ClearTextPassword" value="the_actual_clear_text_password" /> 
    </FeedName> 
</configuration> 

Dies funktioniert, wenn Wir verwenden den Nuget-Installer-Build-Schritt, aber mit dotnet restore nicht.

Bitte helfen Sie, das ist der fehlende Teil, den wir brauchen, um unsere Projekte mit Visual Studio Team Services weiter zu entwickeln.

Antwort

2

Sie können auf diesen Link für Details verweisen: .NET Core.

.NET Core unterstützt derzeit keine verschlüsselten Anmeldeinformationen. Um VSTS NuGet-Feeds mit .NET Core-Anwendungen zu verwenden, müssen Sie einen Personal Access Token im Nur-Text-Format angeben.

+0

Vielen Dank! Nach dem Link habe ich festgestellt, dass die '' Tags in meiner nugget.config fehlen. Das Problem zu lösen, löste mein Problem. – TomRay74