Remove some change
This commit is contained in:
Родитель
fbd3f73e13
Коммит
d7c8d8eeb4
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.TeamFoundation.Build.WebApi;
|
||||
using Microsoft.TeamServices.Samples.Client.Build;
|
||||
using Microsoft.VisualStudio.Services.WebApi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -11,8 +10,9 @@ namespace Microsoft.TeamServices.Samples.Client.Build
|
|||
{
|
||||
[ClientSample(BuildResourceIds.AreaName, BuildResourceIds.BuildsResource)]
|
||||
public class BuildsSample : ClientSample
|
||||
{
|
||||
{
|
||||
[ClientSampleMethod]
|
||||
|
||||
public IEnumerable<BuildDefinitionReference> ListBuildDefinitions()
|
||||
{
|
||||
string projectName = ClientSampleHelpers.FindAnyProject(this.Context).Name;
|
||||
|
@ -28,14 +28,14 @@ namespace Microsoft.TeamServices.Samples.Client.Build
|
|||
do
|
||||
{
|
||||
IPagedList<BuildDefinitionReference> buildDefinitionsPage = buildClient.GetDefinitionsAsync2(
|
||||
project: projectName,
|
||||
project: projectName,
|
||||
continuationToken: continuationToken).Result;
|
||||
|
||||
buildDefinitions.AddRange(buildDefinitionsPage);
|
||||
|
||||
continuationToken = buildDefinitionsPage.ContinuationToken;
|
||||
} while (!String.IsNullOrEmpty(continuationToken));
|
||||
|
||||
|
||||
// Show the build definitions
|
||||
foreach (BuildDefinitionReference definition in buildDefinitions)
|
||||
{
|
||||
|
@ -44,98 +44,5 @@ namespace Microsoft.TeamServices.Samples.Client.Build
|
|||
|
||||
return buildDefinitions;
|
||||
}
|
||||
|
||||
[ClientSampleMethod]
|
||||
public BuildArtifact CreateArtifact()
|
||||
{
|
||||
BuildArtifact result = new BuildArtifact();
|
||||
// Get a build client instance
|
||||
VssConnection connection = Context.Connection;
|
||||
BuildHttpClient buildClient = connection.GetClient<BuildHttpClient>();
|
||||
|
||||
ArtifactResource newArtifactResource = new ArtifactResource()
|
||||
{
|
||||
Type = "new ArtifactResource type",
|
||||
Data = "new ArtifactResource Data",
|
||||
Properties = null,
|
||||
Url = "new Url",
|
||||
DownloadUrl = "new DownloadUrl",
|
||||
DownloadTicket = "new downloadticket"
|
||||
};
|
||||
|
||||
|
||||
BuildArtifact newArtifact = new BuildArtifact()
|
||||
{
|
||||
Id = 900,
|
||||
Name = "New test artifact",
|
||||
Resource = newArtifactResource
|
||||
};
|
||||
|
||||
BuildArtifact newArtifact2 = new BuildArtifact()
|
||||
{
|
||||
Id = 901,
|
||||
Name = "New test artifact 2",
|
||||
Resource = newArtifactResource
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
result = buildClient.CreateArtifactAsync(newArtifact, 1).Result;
|
||||
result = buildClient.CreateArtifactAsync(newArtifact2, 1).Result;
|
||||
|
||||
Console.WriteLine("success");
|
||||
Console.WriteLine("{0}", newArtifact.Name);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine("failed");
|
||||
Console.WriteLine("Error creating artifact: " + ex.InnerException.Message);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[ClientSampleMethod]
|
||||
public List<BuildArtifact> GetAllArtifacts()
|
||||
{
|
||||
// Get a build client instance
|
||||
VssConnection connection = Context.Connection;
|
||||
BuildHttpClient buildClient = connection.GetClient<BuildHttpClient>();
|
||||
|
||||
List<BuildArtifact> artifactsList = buildClient.GetArtifactsAsync(1).Result;
|
||||
|
||||
return artifactsList;
|
||||
}
|
||||
|
||||
[ClientSampleMethod]
|
||||
public BuildArtifact GetArtifact()
|
||||
{
|
||||
VssConnection connection = Context.Connection;
|
||||
BuildHttpClient buildClient = connection.GetClient<BuildHttpClient>();
|
||||
|
||||
BuildArtifact result = buildClient.GetArtifactAsync("Test Project", 1, "New test artifact").Result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[ClientSampleMethod]
|
||||
public void GetFile()
|
||||
{
|
||||
System.Diagnostics.Debugger.Launch();
|
||||
VssConnection connection = Context.Connection;
|
||||
BuildHttpClient buildClient = connection.GetClient<BuildHttpClient>();
|
||||
|
||||
//int buildId, string artifactName, string fileId, string fileName
|
||||
try
|
||||
{
|
||||
var result = buildClient.GetFileAsync(1, "New test artifact", "1", "test file").Result;
|
||||
Console.WriteLine("Get file successed");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.WriteLine("Get File failed: " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче