Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

C# Problem #231

xpt0 ·
Hello,

is there any C# documentation ?

my problem is that i wanna set an environment variable through programming, i have used the example TriggerDependent.cs and wanted it to set an environment variable
i have tried:

VariableFacade variable = new VariableFacade();
variable.setValue("value1");
buildSetting.getVariables().put("var1", variable);

but as im using triggerDependent, i dont see anywhere i can pass buildSetting.


the other problem im having is that whenever i start a long quickbuild process, i get an C# exception:

Exception by proxy call
System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at hessiancsharp.client.CHessianMethodCaller.DoHessianMethodCall(Object[] arrMethodArgs, MethodInfo methodInfo)The operation has timed out

ive looked at quickbuild and the process is started but running, is there anything such as a timeout setting that i can use to wait til it finish ?!
  • replies 6
  • views 4059
  • stars 0
robinshen ADMIN ·
You may refer to <QuickBuild install dir>\api\java\docs\javadoc\com\pmease\quickbuild\RemoteService.html for detail of the CSharp API interface. Although it is java based reference, but it also applies for the CSharp one. For your case, you need to pass the variables directly as below:

VariableFacade variable = new VariableFacade();
variable.setValue("value1");

Hashtable variables = new Hashtable();
variables.Add("variable1", variable);
...
...
remote.triggerDependent(configuration.Id, dependentContext, null, true, variables);

Also the time out issue has been fixed in latest build: 1.2.10 build 97. Please give it a try to see if it works.

Regards.
Robin
xpt0 ·
thank you, just updated quickbuild and the timeout problem is gone

looking at the documentation, ive seen that VariableFacade has 2 methods, setValue and getValue, but they dont seem to be exposed for C# use, it has only a "value" property which i tried setting to some text but it didnt work.

error CS0117: 'com.pmease.quickbuild.model.VariableFacade' does not contain a definition for 'setValue'
robinshen ADMIN ·
Sorry that I am wrong, instead of using setValue method, you should use

variable.Value="value1";

All getters and setters in JavaDoc should be replaced with C# property accessor accordingly.

Regards.
Robin
xpt0 ·
Hello,

i already tried using the Value property, but it didnt work, here is the example code: (it compiles but no variable is set)

VariableFacade variable = new VariableFacade();
variable.Value = "c:\test";
Hashtable variables = new Hashtable();
variables.Add("testpath", variable);

BuildFacade build = remote.triggerDependent(configuration.Id, dependentContext, null, true, variables );

I tried setting the testpath variable in the Builders tab on quickbuild, and triggered it manually, my program showed the value of the variable, so it cant be a problem with my program.
robinshen ADMIN ·
How do you use the variable? Please note that this will define a QuickBuild variable instead of an environment variable. If you do want to use it as environment variable, you'll need extra definition in environment variables section of the builder as below:

testpath=${var["testpath"]}

If it still does not work, please backup your database to xml and send it to me for diagnostics. Please also tell which configuration variables are in question.

Regards.
Robin
xpt0 ·
yeah, i wanted an environment variable, it works now, thank you:)