Can i share views between two web projects using Share Projects Feature? RRS feed

  • Question

  • Hello, 

    i'm trying to work with two web projects (mvc 5) using the same _layout.cshtml, in the follow way:

    1. Create a shared project in visual studio 2015

    2. Put _layout.cshtml in sharedProject/views/shared/_layout.cshtml

    3. Add reference to sharedProject in my mvc5 application

    This does not work. The error is:

    The layout page "~/Views/Shared/_Layout.cshtml" could not be found at the following path: "~/Views/Shared/_Layout.cshtml".

    I already tried add reference to _layout.cshtml file as link in my mvc project. but i receive the following error:

    There is already a link to "sharedProject/Views/Shared/_Layout.cshtml". A project cannot have more than one link to the same file."

    Can i make this work? There is a better approach?

    Thursday, May 19, 2016 12:18 PM

All replies