Problems compiling in VS2010

Topics: Troubleshooting
Dec 19, 2011 at 7:26 PM

I had my Orchard site running from within WebMatrix all the time. I also added some modules from the gallery.

Now, if I open up the SLN in VS I get compilation errors, like this:

Error 1 The type or namespace name 'CKEditor' could not be found (are you missing a using directive or an assembly reference?) c:\Users\Christian\AppData\Local\Temp\Temporary ASP.NET Files\root\8a42c3a4\838e678a\App_Web_pmaxgubg.0.cs 36

 

Any idea what is wrong?

Thanks.

Dec 19, 2011 at 7:38 PM

- Do you get the errors just when opening up or actually when compiling?

- That particular error is coming from a .cshtml file and shouldn't normally matter, if you close open .cshtml files it normally disappears

Dec 19, 2011 at 7:40 PM

All files are closed and the error occurs when compiling.

Dec 19, 2011 at 7:45 PM

What file is the error coming from if you double-click on it?

Have you tried a full rebuild?

Dec 19, 2011 at 7:49 PM

I tried rebuilding all, yes. The error comes from a temp file: App_Web_y05kgold.0.cs

Dec 19, 2011 at 7:57 PM

It's not really coming from a temp file; those files are generated virtually when .cshtml files are compiled. So there is a .cshtml file that's actually throwing the error (or else if the temp file has somehow found its way into your solution you just need to delete it).

Have you by any chance added an override of a CKEditor view into your own theme or another module?

Dec 19, 2011 at 8:01 PM

Hm, nope, no override.

Coordinator
Dec 19, 2011 at 8:04 PM

This must come from a specific module related to CKEditor. Tehre is no such reference in Orchard itself. And what is weird is also the fact that the temp file is under you App_Data. 

Dec 19, 2011 at 8:41 PM

@sebastien, that's his Windows AppData under Users (normal location for temp aspnet files) ... not ~/App_Data in his website.

It will probably be coming from the @model statement, likely one of the .cshtml files in CKEditor module itself. The question is what is causing compilation to go askew. Normally if you double-click on the error in VS it will jump you to the actual .cshtml (even tho you'll sometimes see the error reported from the temp file). Is this not the case here?

Dec 19, 2011 at 9:02 PM

Nope. It jumps to the gen'ed temp file. This is becoming annoying... :(

Coordinator
Dec 19, 2011 at 10:03 PM

Maybe the reference to the CKEditor assembly should be removed and added again, and with a Copy Local flag.

Dec 19, 2011 at 10:40 PM

I can't think why anything would have a reference to CKEditor; it's just a drop-in replacement for body editor, anything that needs it can just use the body editor shape and get either TinyMCE or CKEditor whichever is installed.

@Christian, can you post the contents of the gen'd file, this should at least give a clue which cshtml it's coming from.

To be honest I think your VS or solution configuration might be broken...

Dec 19, 2011 at 10:48 PM

 

#pragma checksum "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "F788C42DFE633560ED033C4335634C6F"
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.488
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace ASP {
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Web;
    using System.Web.Helpers;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.WebPages;
    using System.Web.Mvc;
    using System.Web.Mvc.Ajax;
    using System.Web.Mvc.Html;
    using System.Web.Routing;
    using Orchard.Mvc.Html;
    
    #line 2 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
    using Orchard.ContentManagement;
    
    #line default
    #line hidden
    
    
    public class _Page_Modules_CKEditor_Views_EditorTemplates_Parts_CKEditor_CKEditorSettings_cshtml : Orchard.Mvc.ViewEngines.Razor.WebViewPage<CKEditor.Models.CKEditorSettingsPartRecord> {
        
#line hidden
 
        
        public _Page_Modules_CKEditor_Views_EditorTemplates_Parts_CKEditor_CKEditorSettings_cshtml() {
        }
        
        protected ASP.global_asax ApplicationInstance {
            get {
                return ((ASP.global_asax)(Context.ApplicationInstance));
            }
        }
        
        public override void Execute() {
 
 
WriteLiteral("\r\n");
 
 
            
            #line 4 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Layout.Title = T("CKEditor Settings").ToString(); 
 
            
            #line default
            #line hidden
WriteLiteral("\r\n<fieldset>\r\n    <legend>");
 
 
            
            #line 7 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
       Write(T("CKEditor"));
 
            
            #line default
            #line hidden
WriteLiteral("</legend>\r\n    <div>\r\n        ");
 
 
            
            #line 9 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.LabelFor(m => m.ContentsCss, @T("CSS stylesheet(s) for contents")));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        ");
 
 
            
            #line 10 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.EditorFor(m => m.ContentsCss));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        ");
 
 
            
            #line 11 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.ValidationMessageFor(m => m.ContentsCss, "*"));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        <span class=\"hint\">");
 
 
            
            #line 12 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
                      Write(T("Enter a space-separated list of stylesheet file names to use inside the CKEditor window (e.g. Site.css)"));
 
            
            #line default
            #line hidden
WriteLiteral("</span>\r\n    </div>\r\n    <div>\r\n        ");
 
 
            
            #line 15 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.LabelFor(m => m.ExtraPlugins, @T("Extra plugins to load")));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        ");
 
 
            
            #line 16 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.EditorFor(m => m.ExtraPlugins));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        ");
 
 
            
            #line 17 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.ValidationMessageFor(m => m.ExtraPlugins, "*"));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        <span class=\"hint\">");
 
 
            
            #line 18 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
                      Write(T("Enter a <strong>comma-separated</strong> list of plugin names to be enabled (e.g. 'stylesheetparser,devtools')"));
 
            
            #line default
            #line hidden
WriteLiteral("</span>\r\n    </div>\r\n    <div>\r\n        ");
 
 
            
            #line 21 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.LabelFor(m => m.ClearDefaultStyleSets, @T("Clear default styles")));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        ");
 
 
            
            #line 22 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.EditorFor(m => m.ClearDefaultStyleSets));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        ");
 
 
            
            #line 23 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
   Write(Html.ValidationMessageFor(m => m.ClearDefaultStyleSets, "*"));
 
            
            #line default
            #line hidden
WriteLiteral("\r\n        <span class=\"hint\">");
 
 
            
            #line 24 "C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml"
                      Write(T("If you enable the 'stylesheetparser' plugin, you might want to use this to clear the default styles from the menu"));
 
            
            #line default
            #line hidden
WriteLiteral("</span>\r\n    </div>\r\n</fieldset>");
 
 
        }
    }
}
Jan 7, 2012 at 1:14 AM
What's in the gen'd file? Might tell us what the original is ... But it sounds like something is wrong with your vs or solution config.



ChristianWeyer <notifications@codeplex.com> wrote:


From: ChristianWeyer

Nope. It jumps to the gen'ed temp file. This is becoming annoying... :(

Coordinator
Jan 7, 2012 at 2:32 AM

Try renaming the module.txt file of the ckeditor module to see if it's coming from it only.

Jan 16, 2012 at 11:50 AM
Edited Jan 16, 2012 at 11:52 AM

Bertrand, if I do this then I get this again:

Error 1 The type or namespace name 'CKEditor' could not be found (are you missing a using directive or an assembly reference?) c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\orchard2\25ba54d6\a01980f1\App_Web_fhda33iq.0.cs 36

 

Hm... I need to deploy this soon into Azure :S


Jan 16, 2012 at 12:03 PM

randompete, the code is posted above your question :)

Thanks!

Jan 16, 2012 at 12:23 PM

Oh I see, the file is C:\Users\Christian\Documents\My Web Sites\orchard2\Modules\CKEditor\Views\EditorTemplates\Parts.CKEditor.CKEditorSettings.cshtml ... couldn't see the file name because Codeplex clipped the code area.

The thing is, errors coming from a cshtml file shouldn't stop your application running, and then Orchard should compiled all the views dynamically.

Jan 16, 2012 at 1:32 PM

This is true.

It does not - however - produce a lot of confidence if there are build errors.

Jan 16, 2012 at 2:45 PM

Granted; but I only ever see those errors when the code is not built, once things build they go away. Are you sure you aren't getting compile errors in other modules, that are blocking the overall solution from getting built?

Jan 16, 2012 at 2:52 PM

I do not see any other errors.

Jan 16, 2012 at 3:41 PM

It's very strange; it sounds in all honesty like your VS installation might be broken, do you have a different machine you can try on, and have you tried reinstalling VS?

Jan 16, 2012 at 5:10 PM

I wonder, are you launching VS from within WebMatrix: http://orchard.codeplex.com/discussions/279292

Jan 17, 2012 at 5:46 PM

No, I am starting it not from within WebMatrix.

Sep 10, 2012 at 8:27 PM

So what is the final solution?

I faced with exactly the same trouble.