We are a team trying to upgrade our windows application to use Azure DevOps Services' new REST based .NET Client Libraries instead of Client OM that uses SOAP.
The part of the application that we are upgrading does the following:
Checks out all AssemblyInfoVersion.cs files.
Updates the version on those files.
Checks in all the files.
Create a Label with information about that the version was updated.
We managed to do the first three steps with the new REST based .NET Client Libraries using the CreateChangesetAsync method.
But we can not find any information about how to create a Label so we have not been able to do the last step. Is this really not supported?
Currenlty you can't create a new label with the new Azure DevOps Rest API, you can only get labels.
As workaround, you can use tf.exe with the command label to label the files.
In your code add something like this (using System.Diagnostic):
string tfExePath = "path/to/exe";
string tfArgs = "label test /version:45 $test/src"
Process.Start(tfExePath, tfArgs)
Related
I want to say that I'm new to Azure functions and probably what I'm trying to do may not make sense.
Here we go.
In the function I am creating I have to import content into a database. Whenever I do this I validate if the content is new or if it is a simple update to the data.
After that I take an email template that is in the root "root/EmailsTemplate/MyTemplate.html" I fill in with the data that I collected and send.
However, I cannot access this repository directly. I've seen that I can use Environment.CurrentDirectory, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
or also the ExecutionContext, however they all send me to the \bin\Debug\net472 execution folder. Do I have to use one of these and go back in the folders? Or is there another way? And how will it behave later in the Azure environment?
I use Azure Function V1 (.net Framework 4.7.2)
Thanks
As auburg says, set the below properties of the file can copy the file to \bin\Debug\net472 after you build the project:
And if your function app is on azure, then the content of the root directory is the files in \bin\Debug\net472.
According to the Azure DevOps Services REST API Reference, the request URI has the following format:
https://{instance}[/{team-project}]/_apis[/{area}]/{resource}?api-version={version}
Regarding the api-version:
Every API request should include an api-version to avoid having your app or service break as APIs evolve.
I started using the .NET client libraries for Azure DevOps Services (and TFS) to manage dashboards programmatically.
I am able to connect to Azure DevOps using a Personal Access Token:
var credential = new VssBasicCredential(string.Empty, "PersonalAccessToken");
using (VssConnection connection = new VssConnection(new Uri("...."), credential))
using (var client = connection.GetClient<DashboardHttpClient>())
{
// ...
}
How can I specify the API version? Does it still make sense to do it, when using the .NET client libraries?
The API version is decided by the client libraries. You can confirm this by disassembling them (e.g. using ILSpy).
For example, in the current stable release of Microsoft.TeamFoundationServer.Client, DashboardHttpClientBase has a CreateDashboardAsnc method that makes the following call:
this.SendAsync<Dashboard>(..., new ApiResourceVersion("4.1-preview.2"), ...);
Why are some properties of the build defintions obtained through the TFS client libraries empty? For example, I want to get the retentionRules and daysToKeep properties of a certain build definition but the values returned are empty. When I enter the URL of the build defintion in the browser I get the JSON object with all the expected details.
public static void BuildDefinitionSample()
{
VssConnection connection = new VssConnection(new Uri(collectionUri), new VssClientCredentials());
var buildClient = connection.GetClient<BuildHttpClient>();
var buildDefinitions = buildClient.GetDefinitionsAsync(project: projectName, name: "MyBuildDefinition").Result;
var daysToKeep = buildDefinitions.FirstOrDefault().retentionRules.daysToKeep;
}
How can I get the daysToKeep property of a certain build defintion through the TFS client libraries?
Thank you
TFS Client libraries (SOAP API) use Legacy Client Object Model while WebApi libraries calls the New Rest API to achieve the functions.
Client libraries are primarily there to supply backward compatibility with XAML builds. They cannot work well with the new vNext build system as they were written before their time.
TFS are even using two different Build Retention Policy for XAML build and vNext build. You could not set "daysToKeep" for a XAML build. Details please refer my answer in this question.
So the REST API is the future way to follow and you need use it to get above values in your question.
I have a webservice with .NET 1.1 (old school ASMX) and I am creating a client app to connect to it and use its services.
From what I remember from the last time I had used Visual studio -which was 2003 version!- I can add a WebReference to it and easily use it. Tried it . it still works.
but it looks like things have changed in 2008 and now we also have WCF. so I can add it as a Service Reference. but with this new method I could not find a way to create an Instance object to the ASMX service and call its methods... how do we accomplish the same thing with WCF?
Ok. done:
we should create a ServiceSoapClinet . an example from my play app:
using (LatestServiceSoapClient proxy = new LatestServiceSoapClient("LatestServiceSoap"))
{
label1.Text = proxy.Welcome();
}
I havent worked with that Salesforce API before, so I am a bit stuck on how to connect to the salesforce service.
So far I understood that I have to generate a wsdl file for my account or rather the account of my customer (step 1). So far, so good.
But now the Quickstart (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_quickstart_steps.htm) says something about "Import the WSDL File into your development platform" (step 2).
How do I import a wsdl file into Visual Studio 2008? I cant find the "Add Web Reference" option which is mentioned in the quickstart.
And if I only need to use the WSDL, what use has the Salesforce Dotnet API package which can be downloaded from the salesforce website
(http://wiki.developerforce.com/index.php/Salesforce_Dotnet_API)?
Are there any gotchas I should watch out for when developing applications that use the salesforce API?
If you follow the directions in Binz' answer, you should be able to add a web service reference using Visual Studio.
The "Salesforce Dotnet API package" on the wiki site is not required to access the SalesForce API, it's just a library that tries to abstract it.
As far as gotchas and other things to know, I would recommend that you read chapter 6 of the Force.com Cookbook. You have to sign up for a force.com developer account (free). Most of the things you'll need to be aware of are covered in this chapter. Here are a few of them:
logging in / logging out - session
management
query / queryMore pattern (needed if
you're going to pull large sets of
data from SalesForce)
how to construct a wrapper class -
there is some sample vb.net code you
can download as well
One other thing to note, if you're going to use SOQL to query your SalesForce data, and you need to filter on a SalesForce date field, you'll need to format the date string. Here's one way to do it:
public static string FormatDateForQuery(DateTime dateToFormat, bool includeTime)
{
if (includeTime)
{
return dateToFormat.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss+00:00");
}
else
{
return dateToFormat.ToUniversalTime().ToString("yyyy-MM-dd");
}
}
For Visual Studio 2008 you need to select 'Add Service Reference', then click the 'Advanced' button on the bottom left of the dialogue. There should then be a button on the bottom of that dialogue that says 'Add Web Reference'. You should be able to then select your wsdl file and a service client proxy will be auto genned for you by VS.
To create the WSDL file, go to (your name, top right), set up, develop > api > generate enterprise wsdl > generate. In Chrome, click save page as and put that file in the c drive. In Visual Studio, go to add service reference > advanced > add web reference. Point to the file you downloaded: file:///c:/wsdl.jsp.xml
There is a parsing issue when using .NET 2.0 with date time fields in salesforce, accessing through web services.
It seems to be a bug in .NET but there's another way to address it by manually editing the wsdl.
More information here:
http://community.salesforce.com/t5/NET-Development/Can-t-update-date-datetime-from-c-webservice-through-enterprise/m-p/96046