diff options
Diffstat (limited to 'main/src/addins/AspNet/Projects')
-rw-r--r-- | main/src/addins/AspNet/Projects/AspMvcProject.cs | 88 | ||||
-rw-r--r-- | main/src/addins/AspNet/Projects/AspNetAppProjectBinding.cs | 84 | ||||
-rw-r--r-- | main/src/addins/AspNet/Projects/AspNetFlavor.cs (renamed from main/src/addins/AspNet/Projects/AspNetAppProject.cs) | 289 | ||||
-rw-r--r-- | main/src/addins/AspNet/Projects/AspNetMvcFileTemplateCondition.cs | 2 |
4 files changed, 144 insertions, 319 deletions
diff --git a/main/src/addins/AspNet/Projects/AspMvcProject.cs b/main/src/addins/AspNet/Projects/AspMvcProject.cs index 8161c25ee2..9faf060a04 100644 --- a/main/src/addins/AspNet/Projects/AspMvcProject.cs +++ b/main/src/addins/AspNet/Projects/AspMvcProject.cs @@ -31,37 +31,21 @@ using MonoDevelop.Projects; namespace MonoDevelop.AspNet.Projects { - abstract class AspMvcProject : AspNetAppProject + abstract class AspMvcProject : AspNetFlavor { - protected AspMvcProject () - { - } - - protected AspMvcProject (string languageName) - : base (languageName) - { - } - - protected AspMvcProject (string languageName, ProjectCreateInformation info, XmlElement projectOptions) - : base (languageName, info, projectOptions) - { - } - - public override SolutionItemConfiguration CreateConfiguration (string name) + protected override SolutionItemConfiguration OnCreateConfiguration (string name) { var conf = new AspMvcProjectConfiguration (name); - conf.CopyFrom (base.CreateConfiguration (name)); + conf.CopyFrom (base.OnCreateConfiguration (name)); return conf; } - public override IEnumerable<string> GetProjectTypes () + protected override void OnGetProjectTypes (HashSet<string> types) { - yield return "AspNetMvc"; - foreach (var t in base.GetProjectTypes ()) - yield return t; + types.Add ("AspNetMvc"); } - public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework) + protected override bool OnGetSupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework) { return framework.CanReferenceAssembliesTargetingFramework (MonoDevelop.Core.Assemblies.TargetFrameworkMoniker.NET_3_5); } @@ -75,20 +59,6 @@ namespace MonoDevelop.AspNet.Projects class AspMvc1Project : AspMvcProject
{
- public AspMvc1Project ()
- {
- }
-
- public AspMvc1Project (string languageName)
- : base (languageName)
- {
- }
-
- public AspMvc1Project (string languageName, ProjectCreateInformation info, XmlElement projectOptions)
- : base (languageName, info, projectOptions)
- {
- } - protected override string GetDefaultAspNetMvcVersion () { return "1.0.0.0"; @@ -97,20 +67,6 @@ namespace MonoDevelop.AspNet.Projects class AspMvc2Project : AspMvcProject
{
- public AspMvc2Project ()
- {
- }
-
- public AspMvc2Project (string languageName)
- : base (languageName)
- {
- }
-
- public AspMvc2Project (string languageName, ProjectCreateInformation info, XmlElement projectOptions)
- : base (languageName, info, projectOptions)
- {
- } - protected override string GetDefaultAspNetMvcVersion () { return "2.0.0.0"; @@ -119,21 +75,7 @@ namespace MonoDevelop.AspNet.Projects class AspMvc3Project : AspMvcProject
{
- public AspMvc3Project ()
- {
- }
-
- public AspMvc3Project (string languageName)
- : base (languageName)
- {
- }
-
- public AspMvc3Project (string languageName, ProjectCreateInformation info, XmlElement projectOptions)
- : base (languageName, info, projectOptions)
- {
- }
-
- public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework)
+ protected override bool OnGetSupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework)
{
return framework.CanReferenceAssembliesTargetingFramework (MonoDevelop.Core.Assemblies.TargetFrameworkMoniker.NET_4_0);
} @@ -146,21 +88,7 @@ namespace MonoDevelop.AspNet.Projects class AspMvc4Project : AspMvcProject { - public AspMvc4Project () - { - } - - public AspMvc4Project (string languageName) - : base (languageName) - { - } - - public AspMvc4Project (string languageName, ProjectCreateInformation info, XmlElement projectOptions) - : base (languageName, info, projectOptions) - { - } - - public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework) + protected override bool OnGetSupportsFramework (MonoDevelop.Core.Assemblies.TargetFramework framework) { return framework.CanReferenceAssembliesTargetingFramework (MonoDevelop.Core.Assemblies.TargetFrameworkMoniker.NET_4_0); } diff --git a/main/src/addins/AspNet/Projects/AspNetAppProjectBinding.cs b/main/src/addins/AspNet/Projects/AspNetAppProjectBinding.cs deleted file mode 100644 index 3a89feac81..0000000000 --- a/main/src/addins/AspNet/Projects/AspNetAppProjectBinding.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// AspNetAppProjectBinding.cs: Project binding for AspNetAppProject -// -// Authors: -// Michael Hutchinson <m.j.hutchinson@gmail.com> -// -// Copyright (C) 2006 Michael Hutchinson -// -// -// This source code is licenced under The MIT License: -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.IO; -using MonoDevelop.Core; -using MonoDevelop.Projects; -using MonoDevelop.Core.Serialization; -using System.Xml; - -namespace MonoDevelop.AspNet.Projects -{ - //based heavily on DotNetProjectBinding - public class AspNetAppProjectBinding : IProjectBinding - { - - public string Name { - get { return "AspNetApp"; } - } - - public Project CreateProject (ProjectCreateInformation info, XmlElement projectOptions) - { - string lang = projectOptions.GetAttribute ("language"); - return CreateProject (lang, info, projectOptions); - } - - public Project CreateProject (string language, ProjectCreateInformation info, XmlElement projectOptions) - { - return new AspNetAppProject (language, info, projectOptions); - } - - public Project CreateSingleFileProject (string file) - { - //TODO: get page language - string language = "C#"; - - var info = new ProjectCreateInformation () { - ProjectName = Path.GetFileNameWithoutExtension (file), - SolutionPath = Path.GetDirectoryName (file), - ProjectBasePath = Path.GetDirectoryName (file), - }; - var project = CreateProject (language, info, null); - project.Files.Add (new ProjectFile (file)); - return project; - } - - public bool CanCreateSingleFileProject (string sourceFile) - { - WebSubtype type = AspNetAppProject.DetermineWebSubtype (sourceFile); - - return ((type == WebSubtype.WebForm) - || (type == WebSubtype.WebHandler) - || (type == WebSubtype.WebService)); - } - } -} diff --git a/main/src/addins/AspNet/Projects/AspNetAppProject.cs b/main/src/addins/AspNet/Projects/AspNetFlavor.cs index ef44893202..96902a8fdb 100644 --- a/main/src/addins/AspNet/Projects/AspNetAppProject.cs +++ b/main/src/addins/AspNet/Projects/AspNetFlavor.cs @@ -16,10 +16,10 @@ // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -49,148 +49,130 @@ using MonoDevelop.Ide.TypeSystem; using MonoDevelop.Projects; using MonoDevelop.AspNet.Execution; using MonoDevelop.AspNet.WebForms; +using System.Threading.Tasks; namespace MonoDevelop.AspNet.Projects { [DataInclude (typeof(AspNetAppProjectConfiguration))] - public class AspNetAppProject : DotNetAssemblyProject + public class AspNetFlavor : DotNetProjectExtension { [ItemProperty("XspParameters", IsExternal=true)] XspParameters xspParameters = new XspParameters (); WebFormsRegistrationCache registrationCache; WebFormsCodeBehindTypeNameCache codebehindTypeNameCache; - + #region properties - public override IEnumerable<string> GetProjectTypes () + protected override void OnGetProjectTypes (HashSet<string> types) { - yield return "AspNetApp"; - foreach (var t in base.GetProjectTypes ()) - yield return t; + types.Add ("AspNetApp"); } - public override bool IsLibraryBasedProjectType { + protected override bool IsLibraryBasedProjectType { get { return true; } } - + public XspParameters XspParameters { get { return xspParameters; } } - + internal WebFormsRegistrationCache RegistrationCache { get { if (registrationCache == null) - registrationCache = new WebFormsRegistrationCache (this); + registrationCache = new WebFormsRegistrationCache (Project); return registrationCache; } } - + #endregion - + #region constructors - - public AspNetAppProject () - { - Init (); - } - - public AspNetAppProject (string languageName) - : base (languageName) - { - Init (); - } - - public AspNetAppProject (string languageName, ProjectCreateInformation info, XmlElement projectOptions) - : base (languageName, info, projectOptions) + + protected override void OnInitializeNew (string languageName, ProjectCreateInformation info, XmlElement projectOptions) { - Init (); - + base.OnInitializeNew (languageName, info, projectOptions); + codebehindTypeNameCache = new WebFormsCodeBehindTypeNameCache (Project); + var binPath = info == null? (FilePath)"bin" : info.BinPath; - foreach (var cfg in Configurations.Cast<AspNetAppProjectConfiguration> ()) + foreach (var cfg in Project.Configurations.Cast<DotNetProjectConfiguration> ()) cfg.OutputDirectory = binPath; - } - - public override SolutionItemConfiguration CreateConfiguration (string name) + } + + protected override SolutionItemConfiguration OnCreateConfiguration (string name) { var conf = new AspNetAppProjectConfiguration (name); - conf.CopyFrom (base.CreateConfiguration (name)); - conf.OutputDirectory = BaseDirectory.IsNullOrEmpty? "bin" : (string)BaseDirectory.Combine ("bin"); + conf.CopyFrom (base.OnCreateConfiguration (name)); + conf.OutputDirectory = Project.BaseDirectory.IsNullOrEmpty? "bin" : (string)Project.BaseDirectory.Combine ("bin"); return conf; } - - void Init () - { - codebehindTypeNameCache = new WebFormsCodeBehindTypeNameCache (this); - } - public new AspNetAppProjectConfiguration GetConfiguration (ConfigurationSelector configuration) + public AspNetAppProjectConfiguration GetConfiguration (ConfigurationSelector configuration) { - return (AspNetAppProjectConfiguration) base.GetConfiguration (configuration); + return (AspNetAppProjectConfiguration) Project.GetConfiguration (configuration); } - + #endregion - + public override void Dispose () { codebehindTypeNameCache.Dispose (); RegistrationCache.Dispose (); base.Dispose (); } - + #region build/prebuild/execute - - - protected override BuildResult DoBuild (IProgressMonitor monitor, ConfigurationSelector configuration) + + + protected override Task<BuildResult> OnBuild (ProgressMonitor monitor, ConfigurationSelector configuration) { //if no files are set to compile, then some compilers will error out //though this is valid with ASP.NET apps, so we just avoid calling the compiler in this case bool needsCompile = false; - foreach (ProjectFile pf in Files) { + foreach (ProjectFile pf in Project.Files) { if (pf.BuildAction == BuildAction.Compile) { needsCompile = true; break; } } - + if (needsCompile) - return base.DoBuild (monitor, configuration); - return new BuildResult (); + return base.OnBuild (monitor, configuration); + return Task.FromResult (BuildResult.Success); } - + ExecutionCommand CreateExecutionCommand (ConfigurationSelector config, AspNetAppProjectConfiguration configuration) { return new AspNetExecutionCommand { ClrVersion = configuration.ClrVersion, DebugMode = configuration.DebugMode, XspParameters = XspParameters, - BaseDirectory = BaseDirectory, - TargetRuntime = TargetRuntime, - TargetFramework = TargetFramework, - UserAssemblyPaths = GetUserAssemblyPaths (config), + BaseDirectory = Project.BaseDirectory, + TargetRuntime = Project.TargetRuntime, + TargetFramework = Project.TargetFramework, + UserAssemblyPaths = Project.GetUserAssemblyPaths (config), EnvironmentVariables = configuration.EnvironmentVariables, }; } - + protected override bool OnGetCanExecute (ExecutionContext context, ConfigurationSelector configuration) { var cmd = CreateExecutionCommand (configuration, GetConfiguration (configuration)); return context.ExecutionHandler.CanExecute (cmd); } - - protected override void DoExecute (IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) + + protected async override Task OnExecute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration) { //check XSP is available - + var cfg = GetConfiguration (configuration); var cmd = CreateExecutionCommand (configuration, cfg); var browserExcTarget = (BrowserExecutionTarget) context.ExecutionTarget; IConsole console = null; - var operationMonitor = new AggregatedOperationMonitor (monitor); bool isXsp = true; //FIXME: fix this when it might not be true - should delegate to the ExecutionHandler - + try { //HACK: check XSP exists first, because error UX is cleaner w/o displaying a blank console pad. if (isXsp) { @@ -211,8 +193,8 @@ namespace MonoDevelop.AspNet.Projects // The running Port value is now captured in the XspBrowserLauncherConsole object string url = String.Format ("http://{0}", XspParameters.Address); - - + + if (isXsp) { console = new XspBrowserLauncherConsole (console, delegate (string port) { if (browserExcTarget != null) @@ -221,53 +203,52 @@ namespace MonoDevelop.AspNet.Projects BrowserLauncher.LaunchDefaultBrowser (String.Format("{0}:{1}", url, port)); }); } - + monitor.Log.WriteLine ("Running web server..."); - + var op = context.ExecutionHandler.Execute (cmd, console); - operationMonitor.AddOperation (op); //handles cancellation - + if (!isXsp) { if (browserExcTarget != null) browserExcTarget.DesktopApp.Launch (url); else BrowserLauncher.LaunchDefaultBrowser (url); } - - op.WaitForCompleted (); - + + using (monitor.CancellationToken.Register (op.Cancel)) + await op.Task; + monitor.Log.WriteLine ("The web server exited with code: {0}", op.ExitCode); - + } catch (Exception ex) { if (!(ex is UserException)) { LoggingService.LogError ("Could not launch ASP.NET web server.", ex); } monitor.ReportError ("Could not launch web server.", ex); } finally { - operationMonitor.Dispose (); if (console != null) console.Dispose (); } } - + #endregion - + #region File utility methods - + public WebSubtype DetermineWebSubtype (ProjectFile file) { - if (LanguageBinding != null && LanguageBinding.IsSourceCodeFile (file.FilePath)) + if (Project.LanguageBinding != null && Project.LanguageBinding.IsSourceCodeFile (file.FilePath)) return WebSubtype.Code; return DetermineWebSubtype (file.Name); } - + public static WebSubtype DetermineWebSubtype (string fileName) { string extension = Path.GetExtension (fileName); if (extension == null) return WebSubtype.None; extension = extension.ToUpperInvariant ().TrimStart ('.'); - + //NOTE: No way to identify WebSubtype.Code from here //use the instance method for that switch (extension) { @@ -325,21 +306,21 @@ namespace MonoDevelop.AspNet.Projects return WebSubtype.None; } } - + #endregion - + #region special files - + #endregion - + public ProjectFile ResolveVirtualPath (string virtualPath, string relativeToFile) { string name = VirtualToLocalPath (virtualPath, relativeToFile); if (name == null) return null; - return Files.GetFile (name); + return Project.Files.GetFile (name); } - + public string VirtualToLocalPath (string virtualPath, string relativeToFile) { if (string.IsNullOrEmpty (virtualPath) || virtualPath [0] == '/' || virtualPath.IndexOf (':') > -1) @@ -351,60 +332,60 @@ namespace MonoDevelop.AspNet.Projects virtualPath = virtualPath.Substring (2); else virtualPath = virtualPath.Substring (1); - relativeToDir = BaseDirectory; + relativeToDir = Project.BaseDirectory; } else { relativeToDir = String.IsNullOrEmpty (relativeToFile) - ? BaseDirectory + ? Project.BaseDirectory : (FilePath) Path.GetDirectoryName (relativeToFile); } - + virtualPath = virtualPath.Replace ('/', Path.DirectorySeparatorChar); return relativeToDir.Combine (virtualPath).FullPath; } - + public string LocalToVirtualPath (string filename) { - string rel = FileService.AbsoluteToRelativePath (BaseDirectory, filename); + string rel = FileService.AbsoluteToRelativePath (Project.BaseDirectory, filename); return "~/" + rel.Replace (Path.DirectorySeparatorChar, '/'); } - + public string LocalToVirtualPath (ProjectFile file) { return LocalToVirtualPath (file.FilePath); } - + #region Reference handling - + protected override void OnReferenceAddedToProject (ProjectReferenceEventArgs e) { //short-circuit if the project is being deserialised - if (Loading) { + if (Project.Loading) { base.OnReferenceAddedToProject (e); return; } - + UpdateWebConfigRefs (); - + base.OnReferenceAddedToProject (e); } - + protected override void OnReferenceRemovedFromProject (ProjectReferenceEventArgs e) { //short-circuit if the project is being deserialised - if (Loading) { + if (Project.Loading) { base.OnReferenceAddedToProject (e); return; } - + UpdateWebConfigRefs (); - + base.OnReferenceRemovedFromProject (e); } - + void UpdateWebConfigRefs () { var refs = new List<string> (); - foreach (var reference in References) { + foreach (var reference in Project.References) { //local copied assemblies are copied to the bin directory so ASP.NET references them automatically if (reference.LocalCopy && (reference.ReferenceType == ReferenceType.Project || reference.ReferenceType == ReferenceType.Assembly)) continue; @@ -419,39 +400,39 @@ namespace MonoDevelop.AspNet.Projects continue; refs.Add (reference.Reference); } - + var webConfig = GetWebConfig (); if (webConfig == null || !File.Exists (webConfig.FilePath)) return; - + var textFile = TextFileProvider.Instance.GetEditableTextFile (webConfig.FilePath); //use textfile API because it's write safe (writes out to another file then moves) if (textFile == null) textFile = MonoDevelop.Projects.Text.TextFile.ReadFile (webConfig.FilePath); - + //can't use System.Web.Configuration.WebConfigurationManager, as it can only access virtual paths within an app //so need full manual handling try { var doc = new XmlDocument (); - + //FIXME: PreserveWhitespace doesn't handle whitespace in attribute lists //doc.PreserveWhitespace = true; doc.LoadXml (textFile.Text); - + //hunt our way to the assemblies element, creating elements if necessary XmlElement configElement = doc.DocumentElement; if (configElement == null || string.Compare (configElement.Name, "configuration", StringComparison.OrdinalIgnoreCase) != 0) { configElement = (XmlElement) doc.AppendChild (doc.CreateNode (XmlNodeType.Document, "configuration", null)); } - XmlElement webElement = GetNamedXmlElement (doc, configElement, "system.web"); + XmlElement webElement = GetNamedXmlElement (doc, configElement, "system.web"); XmlElement compilationNode = GetNamedXmlElement (doc, webElement, "compilation"); XmlElement assembliesNode = GetNamedXmlElement (doc, compilationNode, "assemblies"); - + List<XmlNode> existingAdds = new List<XmlNode> (); foreach (XmlNode node in assembliesNode) if (string.Compare (node.Name, "add", StringComparison.OrdinalIgnoreCase) == 0) existingAdds.Add (node); - + //add refs to the doc if they're not in it foreach (string reference in refs) { int index = 0; @@ -477,27 +458,27 @@ namespace MonoDevelop.AspNet.Projects assembliesNode.AppendChild (newAdd); } } - + //any nodes that weren't removed from the existingAdds list are old/redundant, so remove from doc foreach (XmlNode node in existingAdds) assembliesNode.RemoveChild (node); - + StringWriter sw = new StringWriter (); XmlTextWriter tw = new XmlTextWriter (sw); tw.Formatting = Formatting.Indented; doc.WriteTo (tw); tw.Flush (); textFile.Text = sw.ToString (); - + MonoDevelop.Projects.Text.TextFile tf = textFile as MonoDevelop.Projects.Text.TextFile; if (tf != null) tf.Save (); } catch (Exception e) { - LoggingService.LogWarning ("Could not modify application web.config in project " + Name, e); + LoggingService.LogWarning ("Could not modify application web.config in project " + Project.Name, e); } } - - + + XmlElement GetNamedXmlElement (XmlDocument doc, XmlElement parent, string name) { XmlElement result = null; @@ -513,78 +494,78 @@ namespace MonoDevelop.AspNet.Projects } return result; } - + ProjectFile GetWebConfig () { - var webConf = BaseDirectory.Combine ("web.config"); - foreach (var file in Files) + var webConf = Project.BaseDirectory.Combine ("web.config"); + foreach (var file in Project.Files) if (string.Compare (file.FilePath.ToString (), webConf, StringComparison.OrdinalIgnoreCase) == 0) return file; return null; } - + bool IsWebConfig (FilePath file) { - var webConf = BaseDirectory.Combine ("web.config"); + var webConf = Project.BaseDirectory.Combine ("web.config"); return (string.Compare (file, webConf, StringComparison.OrdinalIgnoreCase) == 0); } - + #endregion - + #region File event handlers - + protected override void OnFileAddedToProject (ProjectFileEventArgs e) { //short-circuit if the project is being deserialised - if (Loading) { + if (Project.Loading) { base.OnFileAddedToProject (e); return; } bool webConfigChange = false; List<string> filesToAdd = new List<string> (); - + foreach (ProjectFileEventInfo fargs in e) { IEnumerable<string> files = MonoDevelop.DesignerSupport.CodeBehind.GuessDependencies - (this, fargs.ProjectFile, groupedExtensions); + (Project, fargs.ProjectFile, groupedExtensions); if (files != null) filesToAdd.AddRange (files); if (IsWebConfig (fargs.ProjectFile.FilePath)) webConfigChange = true; } - + if (webConfigChange) UpdateWebConfigRefs (); - + //let the base fire the event before we add files //don't want to fire events out of order of files being added base.OnFileAddedToProject (e); - + //make sure that the parent and child files are in the project foreach (string file in filesToAdd) { //NOTE: this only adds files if they are not already in the project - AddFile (file); + Project.AddFile (file); } } - - public override string GetDefaultBuildAction (string fileName) + + protected override string OnGetDefaultBuildAction (string fileName) { - + WebSubtype type = DetermineWebSubtype (fileName); switch (type) { case WebSubtype.Code: return BuildAction.Compile; case WebSubtype.None: - return base.GetDefaultBuildAction (fileName); + return base.OnGetDefaultBuildAction (fileName); default: return BuildAction.Content; } } - + static string[] groupedExtensions = { ".aspx", ".master", ".ashx", ".ascx", ".asmx", ".asax" }; - + #endregion - + public virtual IEnumerable<string> GetSpecialDirectories () { yield return "App_Browsers"; @@ -598,12 +579,12 @@ namespace MonoDevelop.AspNet.Projects yield return "Models"; yield return "Controllers"; } - + // For "web site" projects // "App_WebReferences", "App_Resources","App_Themes", "App_Code", } - - protected override IList<string> GetCommonBuildActions () + + protected override IList<string> OnGetCommonBuildActions () { return new [] { BuildAction.None, @@ -612,7 +593,7 @@ namespace MonoDevelop.AspNet.Projects BuildAction.EmbeddedResource, }; } - + public string GetCodebehindTypeName (string fileName) { lock (codebehindTypeNameCache) @@ -624,8 +605,8 @@ namespace MonoDevelop.AspNet.Projects var files = new List<string> (); var names = new HashSet<string> (); - string asmDir = Path.GetDirectoryName (typeof (AspNetAppProject).Assembly.Location); - string lang = LanguageName; + string asmDir = Path.GetDirectoryName (GetType().Assembly.Location); + string lang = Project.LanguageName; if (lang == "C#") { lang = "CSharp"; } @@ -635,8 +616,8 @@ namespace MonoDevelop.AspNet.Projects } var dirs = new [] { - Path.Combine (BaseDirectory, "CodeTemplates", type), - Path.Combine (BaseDirectory, "CodeTemplates", lang, type), + Path.Combine (Project.BaseDirectory, "CodeTemplates", type), + Path.Combine (Project.BaseDirectory, "CodeTemplates", lang, type), Path.Combine (asmDir, "CodeTemplates", type), Path.Combine (asmDir, "CodeTemplates", lang, type), }; @@ -650,12 +631,12 @@ namespace MonoDevelop.AspNet.Projects return files; } - protected override void PopulateSupportFileList (FileCopySet list, ConfigurationSelector configuration) + protected override void OnPopulateSupportFileList (FileCopySet list, ConfigurationSelector configuration) { - base.PopulateSupportFileList (list, configuration); + base.OnPopulateSupportFileList (list, configuration); //HACK: workaround for MD not local-copying package references - foreach (MonoDevelop.Projects.ProjectReference projectReference in References) { + foreach (MonoDevelop.Projects.ProjectReference projectReference in Project.References) { if (projectReference.Package != null && projectReference.Package.Name == "system.web.mvc") { if (projectReference.ReferenceType == ReferenceType.Package) foreach (SystemAssembly assem in projectReference.Package.Assemblies) @@ -667,7 +648,7 @@ namespace MonoDevelop.AspNet.Projects public string GetAspNetMvcVersion () { - foreach (var pref in References) { + foreach (var pref in Project.References) { if (pref.Reference.IndexOf ("System.Web.Mvc", StringComparison.OrdinalIgnoreCase) < 0) continue; switch (pref.ReferenceType) { @@ -692,7 +673,7 @@ namespace MonoDevelop.AspNet.Projects public bool SupportsRazorViewEngine { get { - return References.Any (r => r.Reference.StartsWith ("System.Web.WebPages.Razor", StringComparison.Ordinal)); + return Project.References.Any (r => r.Reference.StartsWith ("System.Web.WebPages.Razor", StringComparison.Ordinal)); } } @@ -703,7 +684,7 @@ namespace MonoDevelop.AspNet.Projects public virtual bool IsAspMvcProject { get { - return References.Any (r => r.Reference.StartsWith ("System.Web.Mvc", StringComparison.Ordinal)); + return Project.References.Any (r => r.Reference.StartsWith ("System.Web.Mvc", StringComparison.Ordinal)); } } diff --git a/main/src/addins/AspNet/Projects/AspNetMvcFileTemplateCondition.cs b/main/src/addins/AspNet/Projects/AspNetMvcFileTemplateCondition.cs index 0a4f581ad1..58a71c5371 100644 --- a/main/src/addins/AspNet/Projects/AspNetMvcFileTemplateCondition.cs +++ b/main/src/addins/AspNet/Projects/AspNetMvcFileTemplateCondition.cs @@ -50,7 +50,7 @@ namespace MonoDevelop.AspNet.Projects if (proj == null)
return true;
- var aspProj = proj as AspNetAppProject;
+ var aspProj = proj.GetFlavor<AspNetFlavor> ();
if (aspProj == null)
return false;
|