add jar file as reference to c# console application(no ikvm) -
need execute jar file c# console parameters have written following code
public void updateresults( string runname, int tcid, string teststatus, int almtestid) { { string filename = "d:\\restapi"; string almhost = configurationmanager.appsettings.get("almhost"); string almport = configurationmanager.appsettings.get("port"); string almdomain = configurationmanager.appsettings.get("domain"); string almproject = configurationmanager.appsettings.get("project"); string username = configurationmanager.appsettings.get("username"); string password = configurationmanager.appsettings.get("password"); string testtype = configurationmanager.appsettings.get("testtype"); string owner = configurationmanager.appsettings.get("owner"); string os_name = configurationmanager.appsettings.get("osname"); int testsetid = 444; console.write(almhost); string formatargs = string.format("-jar " + filename + ".jar" + " " + almhost+" " + almport +" "+almdomain+" "+almproject+" "+username+" "+password+ " " +testtype+" "+runname+ " " + owner + " "+tcid+" "+teststatus+" "+ os_name + " " + testsetid ); process proc = new process(); processstartinfo startinfo = new processstartinfo(); startinfo.useshellexecute = false; startinfo.arguments = formatargs; proc.startinfo.workingdirectory = @"c:\program files\java\jre7\bin"; startinfo.filename = "java.exe"; proc.startinfo = startinfo; try { var status = proc.start(); if (status == null) { console.write("error"); } } catch(exception ex) { console.write(ex.message); } proc.waitforexit(); console.readline(); proc.close(); }}
need embed restapi.jar file in project path not hardcoded , can shipped solution.the point make portable can used multiple projects.
appreciate help.
Comments
Post a Comment