Encountered an unexpected error when attempting to resolve tag helper directive '@addTagHelper'

前端 未结 3 1171
有刺的猬
有刺的猬 2021-01-31 07:18

I\'m using Visual Studio 2015 Community edition, and I\'ve created an ASP.NET MVC 5 project.

When I open a view (Index of Home or any other), i

相关标签:
3条回答
  • 2021-01-31 07:48

    I had the same problem, but the above didn't work. I also deleted all 4 files in the Component cache which didn't work. I noticed that the line below <appSettings> was set to false. I changed it to true and the red squigs were gone.

    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    

    0 讨论(0)
  • 2021-01-31 07:52

    In my case it was the reference to System.Web.Mvc had disappeared.

    There was lots of errors in the cshtml files but it would compile and run. Then I found that I had an error in the xxxcontrollers.cs file trying inherit controllers.

    Seems it could compile because the dll was in bin already but it was giving errors.

    I did not relish having to rebuild this project. That would be days and days.

    0 讨论(0)
  • 2021-01-31 07:55

    Here's how I fixed the issue:

    First, reset the Visual Studio Component Cache by closing Visual Studio and deleting this folder:

    C:\Users\[Username]\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache

    And finally, check the web.config files and change:

    <appSettings>
        <add key="webpages:Version" value="2.0.0.0" />
        ...
    </appSettings>
    

    to

    <appSettings>
        <add key="webpages:Version" value="3.0.0.0" />
        ...
    </appSettings>
    
    0 讨论(0)
提交回复
热议问题