public static void AddView(DotNetProject project, string path, string name)
        {
            var provider = project.LanguageBinding.GetCodeDomProvider();

            if (provider == null)
            {
                throw new InvalidOperationException("Project language has null CodeDOM provider");
            }

            string outputFile          = null;
            MvcTextTemplateHost host   = null;
            AddViewDialog       dialog = null;

            try {
                dialog          = new AddViewDialog(project);
                dialog.ViewName = name;

                bool fileGood = false;
                while (!fileGood)
                {
                    var resp = (Gtk.ResponseType)MessageService.RunCustomDialog(dialog);
                    dialog.Hide();
                    if (resp != Gtk.ResponseType.Ok || !dialog.IsValid())
                    {
                        return;
                    }

                    string ext = ".cshtml";
                    if (dialog.ActiveViewEngine == "Aspx")
                    {
                        ext = dialog.IsPartialView ? ".ascx" : ".aspx";
                    }

                    if (!System.IO.Directory.Exists(path))
                    {
                        System.IO.Directory.CreateDirectory(path);
                    }

                    outputFile = System.IO.Path.Combine(path, dialog.ViewName) + ext;

                    if (System.IO.File.Exists(outputFile))
                    {
                        fileGood = MessageService.AskQuestion(GettextCatalog.GetString("Overwrite file?"),
                                                              GettextCatalog.GetString("The file '{0}' already exists.\n", dialog.ViewName) +
                                                              GettextCatalog.GetString("Would you like to overwrite it?"), AlertButton.OverwriteFile, AlertButton.Cancel)
                                   != AlertButton.Cancel;
                    }
                    else
                    {
                        break;
                    }
                }

                host = new MvcTextTemplateHost {
                    LanguageExtension  = provider.FileExtension,
                    ItemName           = dialog.ViewName,
                    ViewDataTypeString = ""
                };

                if (dialog.HasMaster)
                {
                    host.IsViewContentPage   = true;
                    host.ContentPlaceholder  = dialog.PrimaryPlaceHolder;
                    host.MasterPage          = dialog.MasterFile;
                    host.ContentPlaceHolders = dialog.ContentPlaceHolders;
                }
                else if (dialog.IsPartialView)
                {
                    host.IsViewUserControl = true;
                }
                else
                {
                    host.IsViewPage = true;
                }

                if (dialog.IsStronglyTyped)
                {
                    host.ViewDataTypeString = dialog.ViewDataTypeString;
                }

                host.ProcessTemplate(dialog.TemplateFile, outputFile);
                MonoDevelop.TextTemplating.TextTemplatingService.ShowTemplateHostErrors(host.Errors);
            } finally {
                if (host != null)
                {
                    host.Dispose();
                }
                if (dialog != null)
                {
                    dialog.Destroy();
                    dialog.Dispose();
                }
            }

            if (System.IO.File.Exists(outputFile))
            {
                project.AddFile(outputFile);
                IdeApp.ProjectOperations.SaveAsync(project);
            }
        }
		public static void AddView (DotNetProject project, string path, string name)
		{
			var provider = project.LanguageBinding.GetCodeDomProvider ();
			if (provider == null)
				throw new InvalidOperationException ("Project language has null CodeDOM provider");

			string outputFile = null;
			MvcTextTemplateHost host = null;
			AddViewDialog dialog = null;

			try {
				dialog = new AddViewDialog (project);
				dialog.ViewName = name;

				bool fileGood = false;
				while (!fileGood) {
					var resp = (Gtk.ResponseType) MessageService.RunCustomDialog (dialog);
					dialog.Hide ();
					if (resp != Gtk.ResponseType.Ok || ! dialog.IsValid ())
						return;

					string ext = ".cshtml";
					if (dialog.ActiveViewEngine == "Aspx")
						ext = dialog.IsPartialView ? ".ascx" : ".aspx";

					if (!System.IO.Directory.Exists (path))
						System.IO.Directory.CreateDirectory (path);

					outputFile = System.IO.Path.Combine (path, dialog.ViewName) + ext;

					if (System.IO.File.Exists (outputFile)) {
						fileGood = MessageService.AskQuestion (GettextCatalog.GetString ("Overwrite file?"),
							GettextCatalog.GetString ("The file '{0}' already exists.\n", dialog.ViewName) +
							GettextCatalog.GetString ("Would you like to overwrite it?"), AlertButton.OverwriteFile, AlertButton.Cancel)
							!= AlertButton.Cancel;
					} else
						break;
				}

				host = new MvcTextTemplateHost {
					LanguageExtension = provider.FileExtension,
					ItemName = dialog.ViewName,
					ViewDataTypeString = ""
				};

				if (dialog.HasMaster) {
					host.IsViewContentPage = true;
					host.ContentPlaceholder = dialog.PrimaryPlaceHolder;
					host.MasterPage = dialog.MasterFile;
					host.ContentPlaceHolders = dialog.ContentPlaceHolders;
				}
				else if (dialog.IsPartialView)
					host.IsViewUserControl = true;
				else
					host.IsViewPage = true;

				if (dialog.IsStronglyTyped)
					host.ViewDataTypeString = dialog.ViewDataTypeString;

				host.ProcessTemplate (dialog.TemplateFile, outputFile);
				MonoDevelop.TextTemplating.TextTemplatingService.ShowTemplateHostErrors (host.Errors);

			} finally {
				if (host != null)
					host.Dispose ();
				if (dialog != null) {
					dialog.Destroy ();
					dialog.Dispose ();
				}
			}

			if (System.IO.File.Exists (outputFile)) {
				project.AddFile (outputFile);
				IdeApp.ProjectOperations.SaveAsync (project);
			}
		}