c# - Passing an Object to InstallUtil as a parameter -
i have management application calls installutil.exe service installation.
i have custom settings want give directly service. have chance xml file want give parameter.
so have instance custom class , serialized xml , want give parameter , then, service deserialize setting instance.
i see installutil has more 8000 length character limit ok me. tried pass parameter servicedescription takes 34 letters, not more. dont know mistake
string args = xmlsettingshelper.serializeobject(serviceinstaller,false); var args =$"{serviceinstaller.serviceexepath} /i /servicename=\" {serviceinstaller.servicename}\" /servicedisplayname=\" {serviceinstaller.servicedisplayname}\" /servicedescription=\"{args}\""; var process = new process { startinfo = { windowstyle = processwindowstyle.normal, filename = installutilpath, arguments = args, useshellexecute = false, redirectstandardoutput = true, redirectstandarderror = true, createnowindow = true, } }; process.start(); string output = process.standardoutput.readtoend(); console.writeline(output); trace.writeline(output); string err = process.standarderror.readtoend(); console.writeline(err); trace.writeline(err); process.waitforexit()
and cannot deserialize because seems there 34 chars in description
[19796] service description: system.xml.xmlexception: unexpected end of file while parsing name has occurred. line 1, position 34. [19796] @ system.xml.xmltextreaderimpl.throw(exception e) [19796] @ system.xml.xmltextreaderimpl.parseqname(boolean isqname, int32 startoffset, int32& colonpos) [19796] @ system.xml.xmltextreaderimpl.parseattributes() [19796] @ system.xml.xmltextreaderimpl.parseelement() [19796] @ system.xml.xmltextreaderimpl.parsedocumentcontent() [19796] @ system.xml.xmlreader.movetocontent() [19796] @ microsoft.xml.serialization.generatedassembly.xmlserializationreaderserviceinstallerhelper.read5_serviceinstallerhelper() [19796] --- end of inner exception stack trace --- [19796] @ system.xml.serialization.xmlserializer.deserialize(xmlreader xmlreader, string encodingstyle, xmldeserializationevents events) [19796] @ system.xml.serialization.xmlserializer.deserialize(xmlreader xmlreader) [19796] @ iw_servicebusinesslogic.xmlsettingshelper.deserializeobjectbyxmlstring[t](string xmlstring)
so traced , description info shown in bold service description: , 34 chars.
my question how pass object using installutil parameter
Comments
Post a Comment