+ Start a Discussion
AltiumForceAltiumForce 

CompileAndTest Apex code in .NET app

I am writing a small C# app for Apex code deployment, this is because Eclipse with Apex addon seems has problem upload & download unicode characters. 
 
Here is part of my code:
 
Code:
ApexService sfdc = new ApexService();
sfdc.SessionHeaderValue = new SessionHeader();
sfdc.SessionHeaderValue.sessionId = CreateSession(txtUsername.Text, txtPassword.Text).SessionHeaderValue.sessionId;

sfdc.Timeout = 60 * 1000;
sfdc.RequestEncoding = Encoding.UTF8;

CompileClassResult testResult = sfdc.compileClasses(new string[] { txtSourceCode.Lines.ToString() })[0];
if (!testResult.success)
    txtResult.Text += testResult.problem;

When I passed in a simple empty class:  public class TestClass { }, I was getting an error says: unexpected token: System.String
 
Has anyone done this successfully in .NET?
Thanks!

 
 
 
AltiumForceAltiumForce
I've sorted it out:
 
instead of
CompileClassResult testResult = sfdc.compileClasses(new string[] { txtSourceCode.Lines.ToString() })[0];
use
CompileClassResult testResult = sfdc.compileClasses(new string[] { txtSourceCode.Text })[0];