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: /Areas/Admin/Views/SectionView/_MainView.Section1 /Areas/Admin/Views/Shared/_MainView.Section1 /Views/Shared/_MainView.Section1 /Pages/Shared/_MainView.Section1It 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.
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.
Asp.Net Core error System.InvalidOperationException The partial view was not found
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2024 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use