static void GenSample(string name, TestAppConfig appConfig, SuiteConfig suiteConfig, CodeTypeDeclarationCollection instrumentedTypes, bool isLibrary) { CodeDomProvider provider = appConfig.provider; CodeGeneratorOptions options = appConfig.options; CodeStatementCollection testStatements = GenTestCases(instrumentedTypes); CodeTypeDeclaration mainClass = AssemblyGenerator.GenMainClass(testStatements); mainClass.Name = name + "App"; CodeNamespace codeNamespace = AssemblyGenerator.GenNamespaceForInstrumentation(name + "App", provider is VBCodeProvider); codeNamespace.Types.Add(SupportedType.jscriptHackType); codeNamespace.Types.AddRange(instrumentedTypes); codeNamespace.Types.Add(mainClass); CodeCompileUnit unit = AssemblyGenerator.GenInstrumentedAssembly("root\\TestAppZ"); unit.Namespaces.Add(codeNamespace); // CodeCompileUnit unitMod = AssemblyGenerator.GenInstrumentedModule(); string fileName = name + "." + provider.FileExtension; string assemblyName = name + "." + (isLibrary?"dll":"exe"); string target = (isLibrary?" /target:library":""); #if SUBDIRSFORLANG string subDir = Path.Combine(Environment.CurrentDirectory, provider.FileExtension); Directory.CreateDirectory(subDir); string oldDir = Environment.CurrentDirectory; Environment.CurrentDirectory = subDir; #endif Console.WriteLine("Generating " + fileName); using (StreamWriter writer = new StreamWriter(fileName, false, Encoding.ASCII)) { provider.CreateGenerator().GenerateCodeFromCompileUnit(unit, writer, options); } #if xxx string fileNameMod = name + "Mod." + provider.FileExtension; string moduleName = name + "Mod." + "mod"; using (StreamWriter writer = new StreamWriter(fileNameMod, false, Encoding.ASCII)) { provider.CreateGenerator().GenerateCodeFromCompileUnit(unitMod, writer, options); } #endif #if SUBDIRSFORLANG Environment.CurrentDirectory = oldDir; #endif #if SUBDIRSFORLANG suiteConfig.commands1.Add("cd " + provider.FileExtension); #endif suiteConfig.commands1.Add("echo Building " + fileName); suiteConfig.commands1.Add(appConfig.GetComplerCommand(unit) + target + " /out:" + assemblyName + " " + fileName); // suiteConfig.commands1.Add(appConfig.GetComplerCommand(unit) + " /target:module /out:" + moduleName + " " + fileNameMod); #if SUBDIRSFORLANG suiteConfig.commands1.Add("cd .."); #endif #if SUBDIRSFORLANG suiteConfig.commands2.Add("cd " + provider.FileExtension); #endif suiteConfig.commands2.Add("echo InstallUtil " + assemblyName); suiteConfig.commands2.Add("InstallUtil /LogToConsole=false " + assemblyName); #if SUBDIRSFORLANG suiteConfig.commands2.Add("cd .."); #endif }