Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • iNETZO 15 posts 126 karma points
    Apr 17, 2019 @ 09:57
    iNETZO
    0

    using umbraco; missing when using a surfacecontroller (in a class library)

    Hi everybody,

    I've created a class library with surfacecontrollers for member actions. When i call the surfacecontroller form the browser, the view is complaining on line 31 of the compiled view about the missing reference for the "using umbraco":

    Compiler Error Message: CS0246: The type or namespace name 'umbraco' could not be found (are you missing a using directive or an assembly reference?)

    Source Error:

    Line 29:     using Umbraco.Core.Models;
    Line 30:     using Umbraco.Web.Mvc;
    Line 31:     using umbraco;
    Line 32:     using Examine;
    Line 33:     using Umbraco.Web.PublishedContentModels;
    

    My view looks like this (example):

    @using Intranet.Member.Models;
    @inherits Umbraco.Web.Mvc.UmbracoViewPage<Login>
    
    
    <h1>Login</h1>
    Username: @Model.Username
    <br />
    Password: @Model.Password
    

    My question is, how do I create a reference to "umbraco" in Umbraco 8? There is no DLL named umbraco.dll in Umbraco 8 in my bin-folder.

  • Dave de Moel 105 posts 479 karma points c-trib
    Apr 17, 2019 @ 12:49
    Dave de Moel
    0

    Can you post the exact exception you get? There is no namespace called "umbraco" with all lowercase letters. There is the namespace "Umbraco" with capital "U" though.

  • iNETZO 15 posts 126 karma points
    Apr 17, 2019 @ 15:16
    iNETZO
    0

    Hi Dave,

    Thanks for your reaction. The error occures due the lowercase "umbraco" using which is automaticly added to the compiled view.

    Line 2:    //------------------------------------------------------------------------------
    Line 3:    // <auto-generated>
    Line 4:    //     This code was generated by a tool.
    Line 5:    //     Runtime Version:4.0.30319.42000
    Line 6:    //
    Line 7:    //     Changes to this file may cause incorrect behavior and will be lost if
    Line 8:    //     the code is regenerated.
    Line 9:    // </auto-generated>
    Line 10:   //------------------------------------------------------------------------------
    Line 11:   
    Line 12:   namespace ASP {
    Line 13:       using System;
    Line 14:       using System.Collections.Generic;
    Line 15:       using System.IO;
    Line 16:       using System.Linq;
    Line 17:       using System.Net;
    Line 18:       using System.Web;
    Line 19:       using System.Web.Helpers;
    Line 20:       using System.Web.Security;
    Line 21:       using System.Web.UI;
    Line 22:       using System.Web.WebPages;
    Line 23:       using System.Web.Mvc;
    Line 24:       using System.Web.Mvc.Ajax;
    Line 25:       using System.Web.Mvc.Html;
    Line 26:       using System.Web.Routing;
    Line 27:       using Umbraco.Web;
    Line 28:       using Umbraco.Core;
    Line 29:       using Umbraco.Core.Models;
    Line 30:       using Umbraco.Web.Mvc;
    Line 31:       using umbraco;
    Line 32:       using Examine;
    Line 33:       using Umbraco.Web.PublishedContentModels;
    

    I found out that the problem occures when View-file is in the Appplugins folder. When i move the viewfile to the default "Views" folder, the error doesn't occure. But to separate the views in a more modular way i would like to store them in the AppPlugins folder (it's a PluginController). In Umbraco 7 this works fine but in Umbraco 8 i'll get the error above.

  • iNETZO 15 posts 126 karma points
    Apr 23, 2019 @ 14:42
    iNETZO
    100

    I found out that the problem occured due the namespaces in the web.config in de plugin subfolder in the App_plugins folder. I removed the line below to fix it.

    <add namespace="umbraco" />
    
Please Sign in or register to post replies

Write your reply to:

Draft