public string CompileInSeparateAppDomain(string outputAssemblyFileName, params string[] referencedAssemblies) { var outputAssemblyPath = Path.Combine(_buildOutputDirectory, outputAssemblyFileName); var allReferencedAssemblies = _alwaysReferencedAssemblies.Concat(referencedAssemblies).ToArray(); var fullSourceDirectory = Path.Combine(_sourceDirectoryRoot, Path.GetFileNameWithoutExtension(outputAssemblyFileName)); var assemblyCompiler = new AssemblyCompiler(fullSourceDirectory, outputAssemblyPath, allReferencedAssemblies); assemblyCompiler.CompileInSeparateAppDomain(); _generatedAssemblyPaths.Add(outputAssemblyPath); return(outputAssemblyPath); }