Doesn't work.. Well, it apparently can't.
As I read from the exception, CommonHelpers.dll calls zlib1.dll, so that one (CommonHelpers.dll) must be compiled for x86.
Bummer, the side effect of having too many assemblies for small things, yep zlib was called from CommonHelpers
here included :
CrazyInstaller-32bit-2.rar
By the way, do you have any idea why compiled windows form app starts with a console? (Probably you'll see that when you make an example exe)
If you are interested, here is the code that generates the executable, very simple actually.
CODEÂÂÂÂÂÂÂÂpublic static string CreateSelfInstaller(string appPath, string defaultIp, string wadName, byte[] compressedInstallerDol, int uncompressedSize, int iosToUse, string outputFilename)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂif (appPath != String.Empty)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂDirectory.SetCurrentDirectory(appPath);
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂSpitInstallerMetaData(defaultIp, wadName, compressedInstallerDol, uncompressedSize, iosToUse);
ÂÂÂÂÂÂÂÂÂÂÂÂCompilerResults cr;
ÂÂÂÂÂÂÂÂÂÂÂÂCodeDomProvider prov = null;
ÂÂÂÂÂÂÂÂÂÂÂÂprov = CodeDomProvider.CreateProvider("cs");
ÂÂÂÂÂÂÂÂÂÂÂÂCompilerParameters parameters = new CompilerParameters();
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.ReferencedAssemblies.Add("system.dll");
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.ReferencedAssemblies.Add("system.data.dll");
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.ReferencedAssemblies.Add("System.Drawing.dll");
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.ReferencedAssemblies.Add("System.Xml.dll");
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.IncludeDebugInformation = false;
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.EmbeddedResources.Add("InstallerStub\\Resources\\installer.z");
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.GenerateExecutable = true;
ÂÂÂÂÂÂÂÂÂÂÂÂparameters.GenerateInMemory = false;
ÂÂÂÂÂÂÂÂÂÂÂÂstring outputAssembly = wadName.Replace(".wad", ".exe");
ÂÂÂÂÂÂÂÂÂÂÂÂif (outputFilename == String.Empty)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂparameters.OutputAssembly = "wad\\" + outputAssembly;
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂelse
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂparameters.OutputAssembly = outputFilename;
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂList filenames = new List();
ÂÂÂÂÂÂÂÂÂÂÂÂfilenames.Add("InstallerStub\\Info.cs");
ÂÂÂÂÂÂÂÂÂÂÂÂfilenames.Add("InstallerStub\\Form1.Designer.cs");
ÂÂÂÂÂÂÂÂÂÂÂÂfilenames.Add("InstallerStub\\Form1.cs");
ÂÂÂÂÂÂÂÂÂÂÂÂfilenames.Add("InstallerStub\\Program.cs");
ÂÂÂÂÂÂÂÂÂÂÂÂcr = prov.CompileAssemblyFromFile(parameters, filenames.ToArray());
ÂÂÂÂÂÂÂÂÂÂÂÂif (cr.Errors.HasErrors)
ÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂStringBuilder error = new StringBuilder();
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂerror.Append("Error Compiling Expression: \n");
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂforeach (CompilerError err in cr.Errors)
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂerror.AppendFormat("Line {0}: {1}\n", err.Line, err.ErrorText);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂthrow new Exception(error.ToString());
ÂÂÂÂÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂÂÂÂÂreturn outputAssembly;
ÂÂÂÂÂÂÂÂ}
ÂÂÂÂÂÂÂÂprivate static void SpitInstallerMetaData(string defaultIp, string wadName, byte[] compressedInstallerDol, int uncompressedSize, int iosToUse)
ÂÂÂÂÂÂÂÂ{
ÂÂÂÂÂÂÂÂÂÂÂÂStringBuilder sb = new StringBuilder();
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("using System;\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("namespace InstallerStub\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("{\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("public class Info\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("{\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("public static string WadName = \""); sb.Append(wadName); sb.Append("\";\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("public static int UncompressedSize = ");sb.Append(uncompressedSize); sb.Append(";\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("public static int CompressedSize = ");sb.Append(compressedInstallerDol.Length); sb.Append(";\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("public static string DefaultIp = \""); sb.Append(defaultIp); sb.Append("\";\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("public static string DefaultIos = \""); sb.Append(iosToUse); sb.Append("\";\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("}\n");
ÂÂÂÂÂÂÂÂÂÂÂÂsb.Append("}\n");
ÂÂÂÂÂÂÂÂÂÂÂÂstring metaDataClass = sb.ToString();
ÂÂÂÂÂÂÂÂÂÂÂÂFile.WriteAllText("InstallerStub\\Info.cs", metaDataClass);
ÂÂÂÂÂÂÂÂÂÂÂÂFile.WriteAllBytes("InstallerStub\\Resources\\installer.z", compressedInstallerDol);
ÂÂÂÂÂÂÂÂ}