Copied to clipboard

Flag this post as spam?

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


  • Mike Rowe 9 posts 109 karma points
    Feb 18, 2016 @ 18:00
    Mike Rowe
    0

    The type or namespace name 'MyFirstForm' could not be found

    I'm new to Umbraco and all associated technologies. It is for that reason, I find the tutorials very valuable. I have followed the instructions in the tutorial in Documentation=>Getting Started=> Code =>Creating Forms, very carefully.

    I have a document called "Generic" that uses the view (GenericContactForm.cshtml) that loads the Partial View:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
    Layout = null;
    }
    @using MyFirstForm.Models;
       @{
        Html.RenderPartial("~/Views/Partials/ContactForm.cshtml", new ContactFormViewModel());
    }
    

    However, in spite of meticulously following these directions, I get the following error when calling http://localhost/generic:

    Server Error in '/' Application.
    
    Compilation Error 
      Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
    
     Compiler Error Message: CS0246: The type or namespace name 'MyFirstForm' could not be found (are you missing a using directive or an assembly reference?)
    
    Source Error:
    
    Line 3:     Layout = null;
    Line 4:  }
    Line 5:   @using MyFirstForm.Models;
    Line 6:   
    Line 7:  @{
    Source File: c:\ESC_Test\ESCProject\Views\GenericContactForm.cshtml    Line: 5 
    

    I'm using Umbraco 7.4 Thanks in advance for any help to solve this. Once corrected, I will suggest an update to the otherwise great tutorial if appropriate.

    Thank you

  • Kasper Holm 47 posts 180 karma points
    Feb 18, 2016 @ 19:34
    Kasper Holm
    0

    Hello Mike

    I think you need to change

    @using MyFirstForm.Models;
    

    to your projects namespace, maybe something like ESCProject.Models ? :)

  • Mike Rowe 9 posts 109 karma points
    Feb 18, 2016 @ 20:04
    Mike Rowe
    0

    Thank you for the prompt reply. I did change from MyFirstForm.Models to ESCProject.Models. This resulted in a slight improvement in that ESCProject (my Visual Studio project name) was recognized but "Models" was not:

        Compiler Error Message: CS0234: The type or namespace name 'Models' does not exist in the namespace 'ESCProject' (are you missing an assembly reference?)
    
    Source Error:
    
    Line 3:     Layout = null;
    Line 4:  }
    Line 5:   @using ESCProject.Models;
    Line 6:   
    Line 7:  @{
    
    Source File: c:\ESC_Test\ESCProject\Views\GenericContactForm.cshtml    Line: 5 
    

    The path to the Models folder is below the ESCProject folder: C:\ESC_Test\ESCProject\Models\ContactFormViewModel.cs

    yet "Models" is not recognized. I'm using VS 2012 with Umbraco 7.4

    Again, thanks in advance. Mike

  • Kasper Holm 47 posts 180 karma points
    Feb 19, 2016 @ 05:54
    Kasper Holm
    0

    Hey Again mike

    Can i see your ContactFormViewModel.cs please ?

  • Mike Rowe 9 posts 109 karma points
    Feb 19, 2016 @ 15:14
    Mike Rowe
    0
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    
    namespace ESCProject.Models
    {
        public class ContactFormViewModel
        {
            public string Name { get; set; }
            public string Email { get; set; }
            public string Message { get; set; }
        }
    }
    

    Thanks for taking the time.

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Mar 28, 2016 @ 15:28
    Alex Skrypnyk
    0

    Hi Mike,

    Did you build your solution?

  • Gordon 15 posts 96 karma points
    Mar 27, 2017 @ 11:14
    Gordon
    0

    I'm getting the same error, "The type or namespace name 'IDoctype' could not be found" where 'Doctype' is the name of one of my doc types.

    This is the error when I try and build the VS solution. It reports the same for other models too.

    I also can't log into the CMS anymore - the error is "Could not load file or assembly 'Umbraco.ModelsBuilder' or one of its dependencies. The system cannot find the file specified."

    No idea what's causing this, except that I just did a rebuild of the Models in the CMS. I'm using DLL version.

    Any thoughts...?

    Thanks

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies