Why don't my Html Helpers have intellisense?

后端 未结 9 1560
無奈伤痛
無奈伤痛 2020-12-06 15:54

I can\'t get intellisense for my own html helpers. My CustomHtmlHelpers.cs looks like this:

using System.Web.Mvc;
using System.Text;
using Syste         


        
9条回答
  •  日久生厌
    2020-12-06 16:26

    So now I will show you the steps

    1.Create or open an existing class library project (if you open an existing one be sure to remove the MVC5 nuget package)

    2.Add the MVC (5.0) nuget package ( right click project in solution explorer -> Manage NuGet Packages -> search for MVC and install “Microsoft ASP.NET MVC”)

    3.Close any and all open .cshtml files

    4.Right click project -> Properties -> Build -> change Output path to your project “bin/”

    5.Add the following minimal Web.config to the root of your class library project ( the web config file is solely needed for intellisense. Configuration (via Web.config) should be done in the WebApplication hosting your ClassLibrary assembly)

    6.Clean and Build the solution.

    7.Open cshtml file and try now :)

提交回复
热议问题