1

Given two projects:

Project.Common
> Helpers
>> _PartialView.cshtml

Project.FirstProject
> Views
>> Shared
>>> (linked) _PartialView.cshtml

I have added a linked reference to _PartialView.cshtml to Project.FirstProject, linked from Project.Common:

enter image description here

However, what works when I copy the file to this location no longer works with the linked version.

I get the classic MVC "View not found" error (I have renamed the view here in the name of brevity):

The partial view '_PartialView' was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Home/_PartialView.aspx
~/Views/Home/_PartialView.ascx
~/Views/Shared/_PartialView.aspx
~/Views/Shared/_PartialView.ascx
~/Views/Home/_PartialView.cshtml
~/Views/Home/_PartialView.vbhtml
~/Views/Shared/_PartialView.cshtml
~/Views/Shared/_PartialView.vbhtml

Why can't MVC find the linked partial view?

3
  • 1
    Because its in another project. I think partial views are only scoped to the project not the solution Commented Jan 29, 2019 at 16:20
  • @zgood I would expect linking cshtml files to behave in the same way that C# and js files behave. Commented Jan 29, 2019 at 16:21
  • Well I guess your expectations are wrong sorry Commented Jan 29, 2019 at 16:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.