2

I have two mvc projects in the same solution. The parent project Name is WebAPP and the child project name is SocialMedia.

In the SocialMedia project I have a partial view named "_partialSocialMedia.cshtml". I am using it easily in the SocialMedia project, as follows:

@{
    Html.RenderPartial("~/Views/Shared/_partialSocialMedia.cshtml");
 }

I want to use the same partial view into the parent project without re-creating it. I have tried to use it like this:

@{
    Html.RenderPartial("~/SocialMedia/Views/Shared/_partialSocialMedia.cshtml");
 }

But it is giving me an error as the view is not found in the specific path. I have tried a lot of tricks using different path specifications.

Please note: I have already added the SocialMedia project as a reference into WebApp (the parent project) and the partial view exist in the following folder: SocialMedia>Views>Shared>_partialSocialMedia.cshtml.

RubyRedGrapefruit
  • 12,066
  • 16
  • 92
  • 193
Amandeep Singh
  • 372
  • 6
  • 20
  • 1
    `PartialView` can be only accessed to the scope of that Project. you can consider maintaining two `Areas` in the same project, so you can share the `PartialView` across `Areas`. – Kishore Sahasranaman Oct 20 '15 at 08:23
  • [This SO](http://stackoverflow.com/questions/19746/views-in-separate-assemblies-in-asp-net-mvc) should help you. – Siva Gopal Oct 20 '15 at 08:24

0 Answers0