Vault and MSBuild

If you are having a problem using Vault, post a message here.

Moderator: SourceGear

Post Reply
svickery
Posts: 2
Joined: Tue Jun 05, 2007 7:55 am

Vault and MSBuild

Post by svickery » Tue Jun 05, 2007 8:18 am

Hey there, I am trying to use MSBuild with Vault. I am picking back up from where the thread "Vault and MSBuild Tasks" left off. I understand this is not fully supported by SourceGear, but, am hoping for some pointers.

I took the code found here:
http://www.totalannihilation.dk/wordpre ... o-msbuild/

1) I am running Vault client 3.1.9. The readme states "Only works with Vault Server 3.5." Does that mean that integrating vault 3.1.9 _cannot_ be integrated with MSBuild, or that the code I grabbed will not work with 3.1.9?

2) I am guessing that I can integrate the 3.1.9 with MSBuild, but, the code I grabbed does some things that were not supported with 3.1.9. With that in mind, I made the code compile by commenting out a couple things that did not build. The first step is to have MSBuild log in to the vault server. This is failing. Following is some code and the output of the code. Any idea what I am going wrong?

-----------------------------------------------------------
Here is the MSBuild task code of interest:
public void Login()
{
System.Console.WriteLine("pAccessLevel = " + pAccessLevel);
ClientInstance.Init(pAccessLevel);
//Fixed Case to match properly.
if (url.ToLower().EndsWith("/vaultservice") == false)
url += "/VaultService";
if (url.ToLower().StartsWith("http://") == false && url.ToLower().StartsWith("https://") == false)
url = "http://" + url;
System.Console.WriteLine("url = " + url);
System.Console.WriteLine("username = " + username);
System.Console.WriteLine("password = " + password);
try
{
ClientInstance.Login(url, username, password);
}
catch (System.Exception E)
{
System.Console.WriteLine("ClientInstance.Login failed E=" + E);
}

}
---------------------------------------------------------------
Here is the XML I am using with MSBuild:
$ cat getbylabelsample.xml
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/ms
build/2003">
<UsingTask AssemblyFile="MSBuild.Community.Tasks.SourceGearVault.dll"
TaskName="MSBuild.Community.Tasks.SourceGearVault.vaultgetbylabel"/>

<Target Name="MSBuild">
<vaultgetbylabel url="http://vaultdemo.sourcegear.com"
username="svickery"
password="password"
labelstring="MSBuild"
repository="Default Repository"
path="$/ModifiedSource"
destination="C:\Windows\Temp\"/>
</Target>

</Project>
---------------------------------------------------------------
Here is how I am calling msbuild:
msbuild.exe getbylabelsample.xml /Target:MSBuild
---------------------------------------------------------------
And here is the output:
Microsoft (R) Build Engine Version 2.0.50727.42
[Microsoft .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation 2005. All rights reserved.

Build started 6/5/2007 10:05:08 AM.
__________________________________________________
Project "c:\downloads\MSBuild.Community.Tasks.SourceGearVault\MSBuild.Community.
Tasks.SourceGearVault\Compiled\Sample\getbylabelsample.xml" (MSBuild target(s)):


pAccessLevel = Client
url = http://vaultdemo.sourcegear.com/VaultService
username = svickery
password = password
ClientInstance.Login failed E=System.Web.Services.Protocols.SoapException: 1021: FailServiceVersionNotSupported
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at VaultClientNetLib.ClientService.VaultService.ValidateServiceVersions(Int32[] clientSupportedVersions)
at VaultClientNetLib.VaultConnection.Login(String strURLBase, String strUsername, String strPassword)
at VaultClientOperationsLib.ClientInstance.Login(String urlbase, String username, String password)
at MSBuild.Community.Tasks.SourceGearVault.VaultBase.Login()
Target MSBuild:
c:\downloads\MSBuild.Community.Tasks.SourceGearVault\MSBuild.Community.Tasks.SourceGearVault\Compiled\Sample\getbylabelsample.xml(6,6): error : Login to Vault repository failed.
Done building target "MSBuild" in project "getbylabelsample.xml" -- FAILED.

Done building project "getbylabelsample.xml" -- FAILED.

Build FAILED.
c:\downloads\MSBuild.Community.Tasks.SourceGearVault\MSBuild.Community.Tasks.SourceGearVault\Compiled\Sample\getbylabelsample.xml(6,6): error : Login to Vault repository failed.
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:01.55
-------------------------------------------------------
I am guessing that "Login to Vault repository failed." means that I connected to the vault server, but, was unable to login (duh), but, I was able to login to http://vaultdemo.sourcegear.com/VaultService via a browser with the credentials mentioned in the script above. Is this an issue with me trying to use a 3.1.9 client to log into a 3.5.1 server?

Thanks,
Scott Vickery

svickery
Posts: 2
Joined: Tue Jun 05, 2007 7:55 am

Post by svickery » Tue Jun 05, 2007 8:41 am

I can at least answer part of my own question. It appears as if I can connect (login) to a 3.1.9 server with the 3.1.9 libraries. I am guessing this can all be done.

Scott

Post Reply