none
bogus intellisense(??) error putting red squiggles all over razor views!!

    Pertanyaan

  • Getting red squiggles under common calls to html helpers all over my razor pages.

    The expressions are **CORRECT** and the project both compiles and runs without error.

    Simple expressions like the following, get the red squiggles under "Html.LabelFor"...

    @Html.LabelFor(m => m.responseStatus)

    The error message is..

    The type 'Expression<>' is defined in an assembly that is not referenced.You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    If it matters, the target framework for the application is:  .NET 4.5

    The problem began after upgrading to VS 2015.  This never happened in VS 2013 for same project.

    From searching for solutions, I have tried adding the following to web.config without success:

    <compilation debug="true">
          <assemblies>
            <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    
            <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
            <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </assemblies>
    </compilation>
    
    
    These stackoverflows seem to be discussing the same issue, but their solutions have not helped yet:

    http://stackoverflow.com/questions/31086850/the-type-expression-is-defined-in-an-assembly-that-is-not-referenced

    http://stackoverflow.com/questions/6496223/compilation-error-in-net-4-0-web-config-linq-not-found

    Googling the full text of the error message will result in a number of other discussions of the same or similar problem.

    Does anyone know what is going on here and how to fix it?

    The red squiggles are driving me crazy & make editing razor pages much more difficult.

    Minggu, 20 Maret 2016 22.25

Semua Balasan

  • Hi Scott.K.Graham,

    This forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    According to your description, this problem just occurs with the upgrade project, is it right?

    Please check whether you have install any NuGet packages for your project. If installed, please check all these packages to make sure all of them are compatible with Visual Studio 2015.

    Then please try create a new project with Visual Studio 2015 and then move the project files one by one to the new project to make sure which file causes this issue.

    Since your problem is more related to ASP.NET project upgrade, I suggest you post this issue to ASP.NET MVC forum for a better help.

    Best Regards,
    Weiwei

    Selasa, 22 Maret 2016 07.08
  • Hi, thanks.

    It is next to impossible to figure out what topics/subtopics to choose.  To me this seems like a bug in Visual Studio -- showing an error where there is no error.

    Thanks for directing me to the correct forum.

    Selasa, 22 Maret 2016 15.56
  • I am having the exact message as you!

    Celso

    Rabu, 05 Desember 2018 13.54