Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load type mvc c#

Has anyone experienced an issue which the view could not load a type from the assembly since you've moved the type to a different namespace on the same assembly? The only resolution for this is for me to add a new line on the view to detect the change.

Example:
Assembly: MyProject
Initial: MyProject.View.SomeViewMode, MyProject
View: _SomeView

Moving SomeViewModel to a different folder
Assembly: MyProject
Moved: MyProject.ViewModel.SomeViewModel, MyProject
View: _SomeView
Error Encountered (Could not load type MyProject.View.SomeViewModel from assembly MyProject)
Resolution: add a new line to _SomeView

Model declaration: @model SomeViewModel

Web.config
system.web.webPages.razor
namespace:MyProject.ViewModel

Do you have other resolution for this issue? Thanks for all your help

like image 429
Krozen Avatar asked Feb 01 '26 02:02

Krozen


1 Answers

To solve this problem you must stop IIS and clear the Temporary ASP.NET files located here: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root

like image 76
Martin D. Avatar answered Feb 03 '26 15:02

Martin D.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!