public void Startup() { //TODO: Make sure the config is valid! if (ProjectPath.Contains("\\")) { ProjectName = ProjectPath.Substring(ProjectPath.LastIndexOf("\\") + 1); } else { ProjectName = ProjectPath; } ProjectName = ProjectName.Replace(".csproj", string.Empty).Replace(".vbproj", string.Empty); _publishDir = Path.Combine(Directory.GetCurrentDirectory(), PublishDirectory ?? "SpecsForMvc.TestSite"); _intermediateDir = Path.Combine(Directory.GetCurrentDirectory(), IntermediateDirectory ?? "SpecsForMvc.TempIntermediateDir"); var properties = new Dictionary <string, string> { { "DeployOnBuild", "true" }, { "DeployTarget", "Package" }, { "_PackageTempDir", "\"" + _publishDir + "\"" }, //If you think this looks bad, that's because it does. What this //actually outputs looks like: "path\to\whatever\\" //The backslash on the end has to be escaped, otherwise msbuild.exe //will interpret it as escaping the final quote, which is incorrect. { "BaseIntermediateOutputPath", "\"" + _intermediateDir + "\\\\\"" }, { "AutoParameterizationWebConfigConnectionStrings", "false" }, { "Platform", Platform ?? "AnyCPU" }, //Needed for Post-Build events that reference the SolutionDir macro/property. { "SolutionDir", @"""" + Path.GetDirectoryName(SolutionPath) + "\\\\\"" } }; if (!string.IsNullOrEmpty(Configuration)) { properties.Add("Configuration", Configuration); } if (!string.IsNullOrEmpty(OutputPath)) { properties.Add("OutputPath", "\"" + OutputPath + "\\\\\""); } PublishSite(properties); StartIISExpress(); }
public void Compile() { Cpus = Cores ?? (Parallel ? Environment.ProcessorCount : 1); if (SourceFiles != null && SourceFiles.Count > 0) { if (!ProjectPath.Contains(":")) { ProjectPath = new DirectoryInfo(Path.Combine(Environment.CurrentDirectory, ProjectPath)).FullName; } if (UseService) { var server = new CompilerServer(); server.Compile(this); } else if (SeparateAppDomain) { NeedsBuilding = false; CheckBuilding = true; CoreCompile(); CheckBuilding = false; if (NeedsBuilding) { var current = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); var setup = new AppDomainSetup(); setup.ApplicationBase = ProjectPath; setup.PrivateBinPath = MapPath("~/bin") + ";" + MapPath("~/bin/Lazy") + ";" + MapPath("~/bin/Debug") + ";" + MapPath("~/bin/Release") + ";" + MapPath("~/"); setup.ShadowCopyDirectories = setup.PrivateBinPath + ";" + current; setup.ShadowCopyFiles = "true"; var domain = AppDomain.CreateDomain("XamlImageConverter Compiler", null, setup); var aname = Assembly.GetExecutingAssembly().GetName(); var source = setup.PrivateBinPath.Split(';') .Select(p => Path.Combine(p, "XamlImageConverter.dll")) .FirstOrDefault(p => File.Exists(p)); try { Compiler compiler = null; object proxy; if (source == null) { proxy = domain.CreateInstanceFromAndUnwrap(aname.CodeBase, "XamlImageConverter.Compiler"); } else { proxy = domain.CreateInstanceAndUnwrap(aname.FullName, "XamlImageConverter.Compiler"); } compiler = (Compiler)proxy; compiler.InitDomain(); CopyTo(compiler); compiler.SeparateAppDomain = false; compiler.ChildAppDomain = true; //compiler.STAThread = true; compiler.Compile(); hash = compiler.hash; } catch (Exception ex2) { Errors.Error("Internal Error", "33", null, ex2); } finally { AppDomain.Unload(domain); } } } else { CoreCompile(); } if (Serve != null) { Serve(); } Cleanup(); foreach (var logger in Errors.Loggers.OfType <IDisposable>()) { logger.Dispose(); } } }