Asp.Net Core error System.InvalidOperationException The partial view was not found

I was working on a new Asp.Net core project and ran into following error.

System.InvalidOperationException: The partial view '_MainView.Section1' was not found. The following locations were searched:
It was working fine when I was debugging on local machine. When I deployed it on production server, that's when hell broke loose. I did not running into any issue with any other view or partial view of this application. In classic Asp.Net MVC application I could see the folder structure on production server. Asp.Net compiles the views into a DLL. That made it harder to track.

Eventually it dawned on me that only reason a view will be missing is if it is not included in the build. I looked at the properties of this partial view and there was the problem laughing at me.

Asp.Net core error

Build Action was set to value of None. What this value means is that when build takes place for deployment, do not include this file in the package. All I had to do was change this Build Action value to Content. That fixed the issue.




-0.1 °C / 31.8 °F

weather conditions Clouds

Monthly Posts

Blog Tags