Copied to clipboard

Flag this post as spam?

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


  • Walter 4 posts 94 karma points
    Mar 24, 2020 @ 16:40
    Walter
    0

    Add new dll to be used in razor

    The bin folder doesn't contain some dll. For instance, System.Web.Configuration or System.Configuration which can help me to get webconfig values. Others like system.web.Optimization is needed. How can i add a new dll?

    enter image description here

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Apr 23, 2020 @ 21:44
    Alex Skrypnyk
    0

    Hi Walter

    In the "web.config" file in "Views" directory of your project (notice it is not the main web.config in project's root), find this section:

    <system.web.webPages.razor>
      <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <namespaces>
          <add namespace="System.Web.Mvc" />
          <add namespace="System.Web.Mvc.Ajax" />
          .
          .
          <!-- etc -->
        </namespaces>
      </pages>
    </system.web.webPages.razor>
    

    you can add your custom namespace like this:

    <add namespace="My.Custom" />
    

    Thanks,

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft